diff --git a/aria/app/blog/[slug]/page.tsx b/aria/app/blog/[slug]/page.tsx index 166727e5d..af0577040 100644 --- a/aria/app/blog/[slug]/page.tsx +++ b/aria/app/blog/[slug]/page.tsx @@ -7,12 +7,13 @@ import { notFound } from "next/navigation"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { formatDate } from "@/lib/utils"; import Image from "next/image"; +import type { Metadata } from 'next'; type PageProps = { params: Promise<{ slug: string }>; }; -export async function generateMetadata(props: PageProps) { +export async function generateMetadata(props: PageProps): Promise { const params = await props.params; const { @@ -69,7 +70,7 @@ export default async function BlogPage(props: PageProps) {
cover stringToDate(b.date).getTime() - stringToDate(a.date).getTime() + (a, b) => stringToDate(b.date).getTime() - stringToDate(a.date).getTime(), ); return (
@@ -37,7 +37,6 @@ function BlogCard({ title, description, slug, - cover, authors, }: BlogMdxFrontmatter & { slug: string }) { return ( @@ -48,7 +47,7 @@ function BlogCard({

{title}

{title} { - const [files, setFiles] = useState(initialData); // initialData is your recursive data structure - - const addItem = (parentId, type) => { - // Logic to add a folder or file - }; - - const renameItem = (id, newName) => { - // Logic to rename a folder or file - }; - - const deleteItem = (id) => { - // Logic to delete a folder or file - }; - - return ( -
- {files.map((file) => - file.type === "folder" ? ( - - ) : ( - - ) - )} -
- ); -}; - -export default FileExplorer; -``` - -- **Folder**: Renders folders and handles nested items. - -```jsx -// src/components/Folder.js -import React from "react"; -import FileExplorer from "./FileExplorer"; - -const Folder = ({ folder, onAdd, onRename, onDelete }) => { - return ( -
-

{folder.name}

- - - - - {folder.children && } -
- ); -}; - -export default Folder; -``` - -- **File**: Renders individual files with options to rename and delete. - -```jsx -// src/components/File.js -import React from "react"; - -const File = ({ file, onRename, onDelete }) => { - return ( -
-

{file.name}

- - -
- ); -}; - -export default File; -``` - -### 3. Handling State and Actions - -State management is handled using React hooks like `useState` to manage the file system data. Actions such as adding, renaming, and deleting items update the state accordingly. - -```jsx -const [files, setFiles] = useState(initialData); - -const addItem = (parentId, type) => { - // Logic to add a new item to the file system -}; - -const renameItem = (id, newName) => { - // Logic to rename an existing item -}; - -const deleteItem = (id) => { - // Logic to delete an item -}; -``` - -## Conclusion: Building a Dynamic File System with React - -Creating a recursive file system in React is a powerful way to manage hierarchical data and provide a dynamic user experience. By leveraging React's component-based architecture and state management, you can build interactive file systems that handle complex nested structures efficiently. - -Check out the full implementation on [GitHub](https://github.com/nisabmohd/recursive-file-system-react) and explore how these concepts can be applied to your own projects. Happy coding! - -🚀📁 diff --git a/aria/contents/blogs/next-react.mdx b/aria/contents/blogs/why-rewrite-git-host-service-with-rust-language.mdx similarity index 84% rename from aria/contents/blogs/next-react.mdx rename to aria/contents/blogs/why-rewrite-git-host-service-with-rust-language.mdx index d8a0fd866..f3a94fde9 100644 --- a/aria/contents/blogs/next-react.mdx +++ b/aria/contents/blogs/why-rewrite-git-host-service-with-rust-language.mdx @@ -1,17 +1,13 @@ --- -title: "Using React Server Components and Server Actions in Next.js" -description: "Explore how to leverage React Server Components and Server Actions in Next.js to build modern, efficient web applications. Learn how these features enhance performance and simplify server-side logic." -date: 05-09-2024 +title: "Why Rewrite Git Host Service with Rust Language" +description: "" +date: 24-12-2024 authors: - - avatar: "https://ui.shadcn.com/avatars/02.png" - handle: reactdev - username: React Dev - handleUrl: "https://github.com/reactdev" - - avatar: "https://ui.shadcn.com/avatars/01.png" - handle: nextjsguru - username: Next.js Guru - handleUrl: "https://github.com/nextjsguru" -cover: "https://img.freepik.com/premium-vector/many-monsters-various-colors-doodle-come-bless-birthday-happy_577083-85.jpg?w=826" + - avatar: "https://avatars.githubusercontent.com/u/76467?v=4&size=64" + handle: genedna + username: Quanyi Ma + handleUrl: "https://github.com/genedna" +cover: "contents/blogs/why-rewrite-git-host-service-with-rust-language/cover.jpg" --- ## Introduction: Enhancing Next.js with React Server Components diff --git a/aria/public/contents/blogs/why-rewrite-git-host-service-with-rust-language/cover.jpeg b/aria/public/contents/blogs/why-rewrite-git-host-service-with-rust-language/cover.jpeg new file mode 100644 index 000000000..9aa867a18 Binary files /dev/null and b/aria/public/contents/blogs/why-rewrite-git-host-service-with-rust-language/cover.jpeg differ