From ca85b209efb276936f43792244c1aa979ba3392d Mon Sep 17 00:00:00 2001 From: jawad571 Date: Mon, 18 Nov 2024 00:40:31 +0000 Subject: [PATCH] update docs --- .eslintrc.json | 3 + .gitignore | 36 + LICENSE | 21 + README.md | 0 app/blog/[slug]/page.tsx | 100 + app/blog/layout.tsx | 9 + app/blog/page.tsx | 96 + app/docs/[[...slug]]/page.tsx | 51 + app/docs/layout.tsx | 14 + app/error.tsx | 44 + app/favicon.ico | Bin 0 -> 15086 bytes app/layout.tsx | 45 + app/not-found.tsx | 19 + app/opengraph-image.jpg | Bin 0 -> 76350 bytes app/page.tsx | 40 + components.json | 17 + components/anchor.tsx | 38 + components/contexts/theme-provider.tsx | 9 + components/docs-breadcrumb.tsx | 47 + components/docs-menu.tsx | 24 + components/footer.tsx | 57 + components/leftbar.tsx | 55 + components/markdown/copy.tsx | 33 + components/markdown/image.tsx | 25 + components/markdown/link.tsx | 14 + components/markdown/note.tsx | 35 + components/markdown/outlet.tsx | 29 + components/markdown/pre.tsx | 19 + components/markdown/stepper.tsx | 41 + components/navbar.tsx | 114 + components/pagination.tsx | 49 + components/search.tsx | 123 + components/sublink.tsx | 85 + components/theme-toggle.tsx | 40 + components/toc-observer.tsx | 69 + components/toc.tsx | 18 + components/typography.tsx | 9 + components/ui/accordion.tsx | 58 + components/ui/avatar.tsx | 50 + components/ui/breadcrumb.tsx | 115 + components/ui/button.tsx | 57 + components/ui/collapsible.tsx | 11 + components/ui/dialog.tsx | 124 + components/ui/dropdown-menu.tsx | 200 + components/ui/input.tsx | 25 + components/ui/scroll-area.tsx | 48 + components/ui/sheet.tsx | 140 + components/ui/table.tsx | 117 + components/ui/tabs.tsx | 55 + contents/blogs/article.mdx | 0 .../components/code-block/index.mdx | 41 + .../components/custom/index.mdx | 38 + .../components/image-link/index.mdx | 57 + .../docs/getting-started/components/index.mdx | 9 + .../getting-started/components/note/index.mdx | 44 + .../components/stepper/index.mdx | 38 + .../getting-started/components/tabs/index.mdx | 68 + .../docs/getting-started/concepts/index.mdx | 30 + .../getting-started/installation/index.mdx | 57 + .../getting-started/introduction/index.mdx | 46 + .../project-structure/index.mdx | 95 + .../quick-start-guide/index.mdx | 80 + index.html | 8 - lib/markdown.ts | 216 + lib/routes-config.ts | 60 + lib/utils.ts | 80 + next.config.mjs | 13 + package-lock.json | 8498 +++++++++++++++++ package.json | 51 + postcss.config.js | 6 + public/comparit_logo.svg | 124 + public/halloween.png | Bin 0 -> 148694 bytes public/nebula.png | Bin 0 -> 149560 bytes public/ocean.png | Bin 0 -> 149992 bytes public/public-og.png | Bin 0 -> 3454883 bytes styles/globals.css | 63 + styles/syntax.css | 80 + tailwind.config.ts | 84 + tsconfig.json | 26 + 79 files changed, 12332 insertions(+), 8 deletions(-) create mode 100644 .eslintrc.json create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 app/blog/[slug]/page.tsx create mode 100644 app/blog/layout.tsx create mode 100644 app/blog/page.tsx create mode 100644 app/docs/[[...slug]]/page.tsx create mode 100644 app/docs/layout.tsx create mode 100644 app/error.tsx create mode 100644 app/favicon.ico create mode 100644 app/layout.tsx create mode 100644 app/not-found.tsx create mode 100644 app/opengraph-image.jpg create mode 100644 app/page.tsx create mode 100644 components.json create mode 100644 components/anchor.tsx create mode 100644 components/contexts/theme-provider.tsx create mode 100644 components/docs-breadcrumb.tsx create mode 100644 components/docs-menu.tsx create mode 100644 components/footer.tsx create mode 100644 components/leftbar.tsx create mode 100644 components/markdown/copy.tsx create mode 100644 components/markdown/image.tsx create mode 100644 components/markdown/link.tsx create mode 100644 components/markdown/note.tsx create mode 100644 components/markdown/outlet.tsx create mode 100644 components/markdown/pre.tsx create mode 100644 components/markdown/stepper.tsx create mode 100644 components/navbar.tsx create mode 100644 components/pagination.tsx create mode 100644 components/search.tsx create mode 100644 components/sublink.tsx create mode 100644 components/theme-toggle.tsx create mode 100644 components/toc-observer.tsx create mode 100644 components/toc.tsx create mode 100644 components/typography.tsx create mode 100644 components/ui/accordion.tsx create mode 100644 components/ui/avatar.tsx create mode 100644 components/ui/breadcrumb.tsx create mode 100644 components/ui/button.tsx create mode 100644 components/ui/collapsible.tsx create mode 100644 components/ui/dialog.tsx create mode 100644 components/ui/dropdown-menu.tsx create mode 100644 components/ui/input.tsx create mode 100644 components/ui/scroll-area.tsx create mode 100644 components/ui/sheet.tsx create mode 100644 components/ui/table.tsx create mode 100644 components/ui/tabs.tsx create mode 100644 contents/blogs/article.mdx create mode 100644 contents/docs/getting-started/components/code-block/index.mdx create mode 100644 contents/docs/getting-started/components/custom/index.mdx create mode 100644 contents/docs/getting-started/components/image-link/index.mdx create mode 100644 contents/docs/getting-started/components/index.mdx create mode 100644 contents/docs/getting-started/components/note/index.mdx create mode 100644 contents/docs/getting-started/components/stepper/index.mdx create mode 100644 contents/docs/getting-started/components/tabs/index.mdx create mode 100644 contents/docs/getting-started/concepts/index.mdx create mode 100644 contents/docs/getting-started/installation/index.mdx create mode 100644 contents/docs/getting-started/introduction/index.mdx create mode 100644 contents/docs/getting-started/project-structure/index.mdx create mode 100644 contents/docs/getting-started/quick-start-guide/index.mdx delete mode 100644 index.html create mode 100644 lib/markdown.ts create mode 100644 lib/routes-config.ts create mode 100644 lib/utils.ts create mode 100644 next.config.mjs create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 postcss.config.js create mode 100644 public/comparit_logo.svg create mode 100644 public/halloween.png create mode 100644 public/nebula.png create mode 100644 public/ocean.png create mode 100644 public/public-og.png create mode 100644 styles/globals.css create mode 100644 styles/syntax.css create mode 100644 tailwind.config.ts create mode 100644 tsconfig.json diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..bffb357 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "next/core-web-vitals" +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fd3dbb5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,36 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js +.yarn/install-state.gz + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# local env files +.env*.local + +# vercel +.vercel + +# typescript +*.tsbuildinfo +next-env.d.ts diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ab7a1da --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Mohd. Nisab + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/app/blog/[slug]/page.tsx b/app/blog/[slug]/page.tsx new file mode 100644 index 0000000..0150741 --- /dev/null +++ b/app/blog/[slug]/page.tsx @@ -0,0 +1,100 @@ +import { Typography } from "@/components/typography"; +import { buttonVariants } from "@/components/ui/button"; +import { Author, getAllBlogStaticPaths, getBlogForSlug } from "@/lib/markdown"; +import { ArrowLeftIcon } from "lucide-react"; +import Link from "next/link"; +import { notFound } from "next/navigation"; +import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; +import { formatDate } from "@/lib/utils"; +import Image from "next/image"; + +type PageProps = { + params: { slug: string }; +}; + +export async function generateMetadata({ params: { slug } }: PageProps) { + const res = await getBlogForSlug(slug); + if (!res) return null; + const { frontmatter } = res; + return { + title: frontmatter.title, + description: frontmatter.description, + }; +} + +export async function generateStaticParams() { + const val = await getAllBlogStaticPaths(); + if (!val) return []; + return val.map((it) => ({ slug: it })); +} + +export default async function BlogPage({ params: { slug } }: PageProps) { + const res = await getBlogForSlug(slug); + if (!res) notFound(); + return ( +
+ + Back to blog + +
+

+ {formatDate(res.frontmatter.date)} +

+

+ {res.frontmatter.title} +

+
+

Posted by

+ +
+
+
+
+ cover +
+ {res.content} +
+
+ ); +} + +function Authors({ authors }: { authors: Author[] }) { + return ( +
+ {authors.map((author) => { + return ( + + + + + {author.username.slice(0, 2).toUpperCase()} + + +
+

{author.username}

+

+ @{author.handle} +

+
+ + ); + })} +
+ ); +} diff --git a/app/blog/layout.tsx b/app/blog/layout.tsx new file mode 100644 index 0000000..6211155 --- /dev/null +++ b/app/blog/layout.tsx @@ -0,0 +1,9 @@ +import { PropsWithChildren } from "react"; + +export default function BlogLayout({ children }: PropsWithChildren) { + return ( +
+ {children} +
+ ); +} diff --git a/app/blog/page.tsx b/app/blog/page.tsx new file mode 100644 index 0000000..7202d2c --- /dev/null +++ b/app/blog/page.tsx @@ -0,0 +1,96 @@ +import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; +import { Author, BlogMdxFrontmatter, getAllBlogs } from "@/lib/markdown"; +import { formatDate2, stringToDate } from "@/lib/utils"; +import { Metadata } from "next"; +import Image from "next/image"; +import Link from "next/link"; + +export const metadata: Metadata = { + title: "AriaDocs - Blog", +}; + +export default async function BlogIndexPage() { + const blogs = (await getAllBlogs()).sort( + (a, b) => stringToDate(b.date).getTime() - stringToDate(a.date).getTime() + ); + return ( +
+
+

+ The latest blogs of this product +

+

+ All the latest blogs and news, straight from the team. +

+
+
+ {blogs.map((blog) => ( + + ))} +
+
+ ); +} + +function BlogCard({ + date, + title, + description, + slug, + cover, + authors, +}: BlogMdxFrontmatter & { slug: string }) { + return ( + +

{title}

+
+ {title} +
+

{description}

+
+

+ Published on {formatDate2(date)} +

+ +
+ + ); +} + +function AvatarGroup({ users, max = 4 }: { users: Author[]; max?: number }) { + const displayUsers = users.slice(0, max); + const remainingUsers = Math.max(users.length - max, 0); + + return ( +
+ {displayUsers.map((user, index) => ( + + + + {user.username.slice(0, 2).toUpperCase()} + + + ))} + {remainingUsers > 0 && ( + + +{remainingUsers} + + )} +
+ ); +} diff --git a/app/docs/[[...slug]]/page.tsx b/app/docs/[[...slug]]/page.tsx new file mode 100644 index 0000000..07c3dd8 --- /dev/null +++ b/app/docs/[[...slug]]/page.tsx @@ -0,0 +1,51 @@ +import DocsBreadcrumb from "@/components/docs-breadcrumb"; +import Pagination from "@/components/pagination"; +import Toc from "@/components/toc"; +import { page_routes } from "@/lib/routes-config"; +import { notFound } from "next/navigation"; +import { getDocsForSlug } from "@/lib/markdown"; +import { Typography } from "@/components/typography"; + +type PageProps = { + params: { slug: string[] }; +}; + +export default async function DocsPage({ params: { slug = [] } }: PageProps) { + const pathName = slug.join("/"); + const res = await getDocsForSlug(pathName); + + if (!res) notFound(); + return ( +
+
+ + +

{res.frontmatter.title}

+

+ {res.frontmatter.description} +

+
{res.content}
+ +
+
+ +
+ ); +} + +export async function generateMetadata({ params: { slug = [] } }: PageProps) { + const pathName = slug.join("/"); + const res = await getDocsForSlug(pathName); + if (!res) return null; + const { frontmatter } = res; + return { + title: frontmatter.title, + description: frontmatter.description, + }; +} + +export function generateStaticParams() { + return page_routes.map((item) => ({ + slug: item.href.split("/").slice(1), + })); +} diff --git a/app/docs/layout.tsx b/app/docs/layout.tsx new file mode 100644 index 0000000..ef73ca4 --- /dev/null +++ b/app/docs/layout.tsx @@ -0,0 +1,14 @@ +import { Leftbar } from "@/components/leftbar"; + +export default function DocsLayout({ + children, +}: Readonly<{ + children: React.ReactNode; +}>) { + return ( +
+ +
{children}
+
+ ); +} diff --git a/app/error.tsx b/app/error.tsx new file mode 100644 index 0000000..8a8ae0b --- /dev/null +++ b/app/error.tsx @@ -0,0 +1,44 @@ +"use client"; // Error components must be Client Components + +import { Button, buttonVariants } from "@/components/ui/button"; +import Link from "next/link"; +import { useEffect } from "react"; + +export default function Error({ + error, + reset, +}: { + error: Error & { digest?: string }; + reset: () => void; +}) { + useEffect(() => { + console.error(error); + }, [error]); + + return ( +
+
+

Oops!

+

+ Something went wrong {":`("} +

+

+ We're sorry, but an error occurred while processing your request. +

+
+
+ + + Back to homepage + +
+
+ ); +} diff --git a/app/favicon.ico b/app/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..56276eba52863caaef12b1e3790667e3e8f1e6dc GIT binary patch literal 15086 zcmeI3XOL9K5y$s9;K+Aiay)VrATpFp5*Z1QL=ZViB$1&IU||kKkR?E51PG2K3E9H_ zppTYaS7kogRW64wmhCc>gXC0B>i5^i^XEa#TCy*vDnY_u1GoG*VK;14yiydl~I-0G7;~6>Q{i?`L$}f+WGk|zZwuY^78Ub zE@Yq|f~l?^PKm6Ht5;Cq8rH90ZKzJ|+Hq{c`8`o^HkzvEKPTX?TesR^M~@-=$Z}ki zFKQtAswgO*tCuDI2KDMWsJ{9U;&(RvnFRl@gqgW@jOh2d#BX@pwQlVm>C?w`>)hED zHEx`h97*t_Z`OxHVeC9tMgOMn4(-~x*)wOlBL@z+(sSqB`Qyjk*7fV%-~j_%lSYlI zBu5JTKNi++W{cl&w`kVPO&mMceQE!G_wJP|?$(VPaeD9ib$9v98Mk`*a@V~}7jH}T zGq9-?`00Z?RmE?(3#HSck3Q&-XaEn)r2wQKIo(W7p|s#WfbJ9fAmyq7$@ zKmFQkZtkpE4*N1&t88pU;7_{FR%So&g=f!h-Q2q8p7Xjz$6n88&w4%g(ziwp8o1{4 z%eZmw@ZP=gez~ds;dz4kt65P|rE)~zrw{IlEFh`xm!t z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