From c3b5e574d6afb3cc269982a3f81f70888fe06564 Mon Sep 17 00:00:00 2001 From: zaaakher Date: Sat, 23 Sep 2023 00:24:49 +0300 Subject: [PATCH] [skip_publish, deploy_docs] Setting up docs pages --- docs/README.md | 24 +--- docs/components/footer.jsx | 7 + docs/package.json | 2 +- docs/pages/404.mdx | 5 + docs/pages/_app.mdx | 2 +- docs/pages/_meta.json | 23 ++-- docs/pages/docs/_meta.json | 17 +++ docs/pages/docs/about.mdx | 3 - docs/pages/docs/advanced.mdx | 3 - docs/pages/docs/advanced/satori.mdx | 3 - docs/pages/docs/another.mdx | 31 ----- docs/pages/docs/authentication.mdx | 1 + docs/pages/docs/authentication/_meta.json | 5 + docs/pages/docs/authentication/login.mdx | 1 + docs/pages/docs/authentication/logout.mdx | 1 + docs/pages/docs/authentication/register.mdx | 1 + docs/pages/docs/database.mdx | 1 + docs/pages/docs/database/_meta.json | 3 + docs/pages/docs/database/setup.mdx | 1 + docs/pages/docs/function1.mdx | 141 -------------------- docs/pages/docs/function2.mdx | 18 --- docs/pages/docs/function3.mdx | 18 --- docs/pages/docs/function4.mdx | 16 --- docs/pages/docs/index.mdx | 71 ++++++++++ docs/pages/docs/roles-queries.mdx | 7 + docs/pages/docs/user-queries.mdx | 7 + docs/pages/index.mdx | 6 +- docs/theme.config.tsx | 39 ++++-- docs/yarn.lock | 8 +- 29 files changed, 185 insertions(+), 280 deletions(-) create mode 100644 docs/components/footer.jsx create mode 100644 docs/pages/404.mdx create mode 100644 docs/pages/docs/_meta.json delete mode 100644 docs/pages/docs/about.mdx delete mode 100644 docs/pages/docs/advanced.mdx delete mode 100644 docs/pages/docs/advanced/satori.mdx delete mode 100644 docs/pages/docs/another.mdx create mode 100644 docs/pages/docs/authentication.mdx create mode 100644 docs/pages/docs/authentication/_meta.json create mode 100644 docs/pages/docs/authentication/login.mdx create mode 100644 docs/pages/docs/authentication/logout.mdx create mode 100644 docs/pages/docs/authentication/register.mdx create mode 100644 docs/pages/docs/database.mdx create mode 100644 docs/pages/docs/database/_meta.json create mode 100644 docs/pages/docs/database/setup.mdx delete mode 100644 docs/pages/docs/function1.mdx delete mode 100644 docs/pages/docs/function2.mdx delete mode 100644 docs/pages/docs/function3.mdx delete mode 100644 docs/pages/docs/function4.mdx create mode 100644 docs/pages/docs/roles-queries.mdx create mode 100644 docs/pages/docs/user-queries.mdx diff --git a/docs/README.md b/docs/README.md index 7b33473..eaabcc2 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,23 +1,5 @@ -# Nextra Docs Template +# Hajar Documentation -This is a template for creating documentation with [Nextra](https://nextra.site). +[Docs](https://hajar.sikka.io) -[**Live Demo →**](https://nextra-docs-template.vercel.app) - -[![](.github/screenshot.png)](https://nextra-docs-template.vercel.app) - -## Quick Start - -Click the button to clone this repository and deploy it on Vercel: - -[![](https://vercel.com/button)](https://vercel.com/new/clone?s=https%3A%2F%2Fgithub.com%2Fshuding%2Fnextra-docs-template&showOptionalTeamCreation=false) - -## Local Development - -First, run `pnpm i` to install the dependencies. - -Then, run `pnpm dev` to start the development server and visit localhost:3000. - -## License - -This project is licensed under the MIT License. +Made with next.js & nextra. diff --git a/docs/components/footer.jsx b/docs/components/footer.jsx new file mode 100644 index 0000000..97b8198 --- /dev/null +++ b/docs/components/footer.jsx @@ -0,0 +1,7 @@ +import React from "react"; + +const Footer = () => { + return
F
; +}; + +export default Footer; diff --git a/docs/package.json b/docs/package.json index 0ec6c0f..e4e2a02 100644 --- a/docs/package.json +++ b/docs/package.json @@ -11,7 +11,7 @@ "license": "MIT", "homepage": "https://hajar.sikka.io", "dependencies": { - "@sikka/hawa": "^0.2.3", + "@sikka/hawa": "^0.2.19-beta", "next": "^13.0.6", "nextra": "latest", "nextra-theme-docs": "latest", diff --git a/docs/pages/404.mdx b/docs/pages/404.mdx new file mode 100644 index 0000000..ebccbfa --- /dev/null +++ b/docs/pages/404.mdx @@ -0,0 +1,5 @@ +import { NotFoundPage } from 'nextra-theme-docs' + +# 404: Page Not Found + + \ No newline at end of file diff --git a/docs/pages/_app.mdx b/docs/pages/_app.mdx index 30cde5c..85245d4 100644 --- a/docs/pages/_app.mdx +++ b/docs/pages/_app.mdx @@ -1,5 +1,5 @@ import "../styles.css"; -import "@sikka/hawa/src/styles.css"; +import "@sikka/hawa/dist/style.css"; export default function App({ Component, pageProps }) { return ; diff --git a/docs/pages/_meta.json b/docs/pages/_meta.json index 3ba4f88..6093884 100644 --- a/docs/pages/_meta.json +++ b/docs/pages/_meta.json @@ -1,23 +1,28 @@ { "index": { - "title": "Introduction", + "title": "Hajar", "type": "page", - "display": "hidden" + "display": "hidden", + "theme": { + "layout": "raw" + } }, "docs": { "type": "page", "title": "Docs" }, - "another": "Another Page", - "advanced": "Advanced (A Folder)", - "about": { - "title": "About", - "type": "page" - }, + "contact": { "title": "Contact ↗", "type": "page", - "href": "https://twitter.com/shuding_", + "href": "https://twitter.com/sikka_sa", "newWindow": true + }, + "404": { + "type": "page", + "theme": { + "timestamp": false, + "typesetting": "article" + } } } diff --git a/docs/pages/docs/_meta.json b/docs/pages/docs/_meta.json new file mode 100644 index 0000000..de44a4d --- /dev/null +++ b/docs/pages/docs/_meta.json @@ -0,0 +1,17 @@ +{ + "index": "Introduction", + + "--Methods": { + "title": "Methods", + "type": "separator" + }, + + "authentication": "Authentication", + "database": "Database", + "email": "Emails", + "storage": "Storage", + "--queries": { + "title": "Queries", + "type": "separator" + } +} diff --git a/docs/pages/docs/about.mdx b/docs/pages/docs/about.mdx deleted file mode 100644 index ec6faed..0000000 --- a/docs/pages/docs/about.mdx +++ /dev/null @@ -1,3 +0,0 @@ -# About - -This is the about page! This page is shown on the navbar. diff --git a/docs/pages/docs/advanced.mdx b/docs/pages/docs/advanced.mdx deleted file mode 100644 index a1a5148..0000000 --- a/docs/pages/docs/advanced.mdx +++ /dev/null @@ -1,3 +0,0 @@ -# Advanced - -This is the index page for the Advanced folder! diff --git a/docs/pages/docs/advanced/satori.mdx b/docs/pages/docs/advanced/satori.mdx deleted file mode 100644 index 46eb19f..0000000 --- a/docs/pages/docs/advanced/satori.mdx +++ /dev/null @@ -1,3 +0,0 @@ -# Satori - -Satori (悟り) is a Japanese Buddhist term for awakening, "comprehension; understanding". diff --git a/docs/pages/docs/another.mdx b/docs/pages/docs/another.mdx deleted file mode 100644 index 77f7403..0000000 --- a/docs/pages/docs/another.mdx +++ /dev/null @@ -1,31 +0,0 @@ -# Another Page - -```js filename="demo.js" {3} copy -let a = 1; - -console.log(a); -``` - -## Component - -import { useState } from 'react' - -{/* Import CSS modules */} -import styles from '../../components/counters.module.css' - -export const Counter = () => { - const [count, setCount] = useState(0); - return ( -
- -
- ); -}; - - - -## External Component - -import Counters from '../../components/counters' - - diff --git a/docs/pages/docs/authentication.mdx b/docs/pages/docs/authentication.mdx new file mode 100644 index 0000000..e395cb2 --- /dev/null +++ b/docs/pages/docs/authentication.mdx @@ -0,0 +1 @@ +# This is authentication page \ No newline at end of file diff --git a/docs/pages/docs/authentication/_meta.json b/docs/pages/docs/authentication/_meta.json new file mode 100644 index 0000000..26bc6d8 --- /dev/null +++ b/docs/pages/docs/authentication/_meta.json @@ -0,0 +1,5 @@ +{ + "login": "Login", + "logout": "Logout", + "register": "Register" +} diff --git a/docs/pages/docs/authentication/login.mdx b/docs/pages/docs/authentication/login.mdx new file mode 100644 index 0000000..1ab33f9 --- /dev/null +++ b/docs/pages/docs/authentication/login.mdx @@ -0,0 +1 @@ +# This is login page diff --git a/docs/pages/docs/authentication/logout.mdx b/docs/pages/docs/authentication/logout.mdx new file mode 100644 index 0000000..adb41fe --- /dev/null +++ b/docs/pages/docs/authentication/logout.mdx @@ -0,0 +1 @@ +# this is logout page \ No newline at end of file diff --git a/docs/pages/docs/authentication/register.mdx b/docs/pages/docs/authentication/register.mdx new file mode 100644 index 0000000..a936735 --- /dev/null +++ b/docs/pages/docs/authentication/register.mdx @@ -0,0 +1 @@ +# this is register page diff --git a/docs/pages/docs/database.mdx b/docs/pages/docs/database.mdx new file mode 100644 index 0000000..bbf9262 --- /dev/null +++ b/docs/pages/docs/database.mdx @@ -0,0 +1 @@ +# This is database page \ No newline at end of file diff --git a/docs/pages/docs/database/_meta.json b/docs/pages/docs/database/_meta.json new file mode 100644 index 0000000..5eb46c6 --- /dev/null +++ b/docs/pages/docs/database/_meta.json @@ -0,0 +1,3 @@ +{ + "setup": "SetupDatabase" +} diff --git a/docs/pages/docs/database/setup.mdx b/docs/pages/docs/database/setup.mdx new file mode 100644 index 0000000..1ab33f9 --- /dev/null +++ b/docs/pages/docs/database/setup.mdx @@ -0,0 +1 @@ +# This is login page diff --git a/docs/pages/docs/function1.mdx b/docs/pages/docs/function1.mdx deleted file mode 100644 index cd6aae0..0000000 --- a/docs/pages/docs/function1.mdx +++ /dev/null @@ -1,141 +0,0 @@ -# Function 1 - -Here is the documentation for Function 1. - -## Usage - -... - -## Parameters - -import { Callout, Steps } from 'nextra/components' - - -### Configure Nextra to Use the Theme - -First, you need to tell Nextra to use your custom theme file instead of official -ones. In your Next.js config, you can pass the path to your theme file to the -Nextra plugin: - -```js {2} filename="next.config.js" -const withNextra = require('nextra')({ - theme: './theme.tsx', -}) - -module.exports = withNextra({ - // Other Next.js configurations - ... -}) -``` - -### Create a Basic Theme - -You can now start working on your theme! In your root directory, create the -corresponding `theme.tsx` file with basic content: - -```tsx filename="theme.tsx" /children/ -import type { NextraThemeLayoutProps } from 'nextra' - -export default function Layout({ children }: NextraThemeLayoutProps) { - return ( -
-

My Theme

-
{children}
-
- ) -} -``` - -It accepts a `children` prop, which is the MDX content of the current page, and -wraps some other elements around the content. After creating the theme, you can -simply add a MDX file as `pages/index.mdx` and see the result: - - - -
- -Inside your theme layout, you can use CSS imports or other ways to style it. -Next.js hooks such as `useRouter`, `Head` are also available. - -### Render Metadata for the Active Page - -Other than `children`, some other useful props are passed to the theme layout -too. With the `pageOpts` props, the theme can access the page’s meta -information. - -For example, let’s implement these features: - -- Render the page title in `` -- Show a simple table of contents -- Add a meta tag for `og:image` via the front matter - -```tsx filename="theme.tsx" /pageOpts/ -import Head from 'next/head' -import type { NextraThemeLayoutProps } from 'nextra' - -export default function Layout({ children, pageOpts }: NextraThemeLayoutProps) { - const { title, frontMatter, headings } = pageOpts - - return ( - <div> - <Head> - <title>{title} - - -

My Theme

- Table of Contents: -
    - {headings.map(heading => ( -
  • {heading.value}
  • - ))} -
-
{children}
- - ) -} -``` - -### Use Page Map of the Entire Site - -Now, if you want to render something like a sidebar or a navigation bar, which -relies on information of not only the current page but also other pages, you can -use the `pageMap` value. - -For example, we can render a simple navigation list with all the pages in the -top level: - -```tsx filename="theme.tsx" /pageMap/ -import Link from 'next/link' -import type { NextraThemeLayoutProps } from 'nextra' - -export default function Layout({ children, pageOpts }: NextraThemeLayoutProps) { - const { pageMap } = pageOpts - - return ( -
-

My Theme

- {pageMap.map(item => { - if (item.kind === 'MdxPage') { - return ( - - {item.route} - - ) - } - return null - })} -
{children}
-
- ) -} -``` - -There are other item kinds such as `Folder` (for directories) and `Meta` (for -`_meta.json` files). All the items are typed so you can easily know the -properties. - -
- -## Return Value - -Description of the return value diff --git a/docs/pages/docs/function2.mdx b/docs/pages/docs/function2.mdx deleted file mode 100644 index 092878e..0000000 --- a/docs/pages/docs/function2.mdx +++ /dev/null @@ -1,18 +0,0 @@ -# SignInVia - -Here is the documentation for Function 1. - -## Usage - -... - -## Parameters - -#### `param1` - - Description of param1 -- `param2`: Description of param2 - -## Return Value - -Description of the return value diff --git a/docs/pages/docs/function3.mdx b/docs/pages/docs/function3.mdx deleted file mode 100644 index 0aaee31..0000000 --- a/docs/pages/docs/function3.mdx +++ /dev/null @@ -1,18 +0,0 @@ -# Function 1 - -testing - -Here is the documentation for Function 1. - -## Usage - -... - -## Parameters - -- `param1`: Description of param1 -- `param2`: Description of param2 - -## Return Value - -Description of the return value diff --git a/docs/pages/docs/function4.mdx b/docs/pages/docs/function4.mdx deleted file mode 100644 index 59020be..0000000 --- a/docs/pages/docs/function4.mdx +++ /dev/null @@ -1,16 +0,0 @@ -# Function 1 - -Here is the documentation for Function 1. - -## Usage - -... - -## Parameters - -- `param1`: Description of param1 -- `param2`: Description of param2 - -## Return Value - -Description of the return value diff --git a/docs/pages/docs/index.mdx b/docs/pages/docs/index.mdx index f4a13a6..9555ec1 100644 --- a/docs/pages/docs/index.mdx +++ b/docs/pages/docs/index.mdx @@ -1,5 +1,76 @@ # DOC INDEX PAGE +# Another Page + +```js filename="demo.js" {3} copy +let a = 1; + +console.log(a); +``` + +## Component + +import { useState } from "react"; + +{/* Import CSS modules */} +import styles from '../../components/counters.module.css' + +export const Counter = () => { + const [count, setCount] = useState(0); + return ( +
+ +
+ ); +}; + + + +## External Component + +import Counters from "../../components/counters"; + + + ## Satori Satori (悟り) is a Japanese Buddhist term for awakening, "comprehension; understanding". + +# SignInVia + +Here is the documentation for Function 1. + +## Usage + +... + +## Parameters + +#### `param1` + +Description of param1 + +- `param2`: Description of param2 + +## Return Value + +Description of the return value + +# Function 1 + +Here is the documentation for Function 1. + +## Usage + +... + +## Parameters + +- `param1`: Description of param1 +- `param2`: Description of param2 + +## Return Value + +Description of the return value diff --git a/docs/pages/docs/roles-queries.mdx b/docs/pages/docs/roles-queries.mdx new file mode 100644 index 0000000..b5a7509 --- /dev/null +++ b/docs/pages/docs/roles-queries.mdx @@ -0,0 +1,7 @@ +# getRoles + +# deleteRole + +# updateRole + +# getAllGrantedPermissions diff --git a/docs/pages/docs/user-queries.mdx b/docs/pages/docs/user-queries.mdx new file mode 100644 index 0000000..4490536 --- /dev/null +++ b/docs/pages/docs/user-queries.mdx @@ -0,0 +1,7 @@ +# + +# getUserByToken + +# getUserByEmail + +# getUserById diff --git a/docs/pages/index.mdx b/docs/pages/index.mdx index 3381be1..09b73c7 100644 --- a/docs/pages/index.mdx +++ b/docs/pages/index.mdx @@ -1,5 +1,5 @@ --- -title: React Hooks for Data Fetching +title: Toolkit for SaaS Apps --- import { Callout } from "nextra-theme-docs"; @@ -11,9 +11,9 @@ import { Bleed } from "nextra-theme-docs"; } {

SWR

} - +{/* */} - +{/* */} The name “SWR” is derived from `stale-while-revalidate`, a HTTP cache invalidation strategy popularized by [HTTP RFC 5861](https://tools.ietf.org/html/rfc5861). SWR is a strategy to first return the data from cache (stale), then send the fetch request (revalidate), and finally come with the up-to-date data. diff --git a/docs/theme.config.tsx b/docs/theme.config.tsx index 6f7b09a..016db07 100644 --- a/docs/theme.config.tsx +++ b/docs/theme.config.tsx @@ -1,6 +1,7 @@ import React from "react"; import { DocsThemeConfig } from "nextra-theme-docs"; import { useRouter } from "next/router"; +import { Footer } from "@sikka/hawa"; const config: DocsThemeConfig = { project: { @@ -8,8 +9,7 @@ const config: DocsThemeConfig = { }, docsRepositoryBase: "https://github.com/sikka-software/hajar/docs", - logo: My Project, - + logo: Hajar, // docsRepository: "https://github.com/your-repo", // docs repo // branch: "master", // branch of docs // titleSuffix: " – Your Docs", @@ -24,23 +24,46 @@ const config: DocsThemeConfig = { head: ( <> - - + + ), useNextSeoProps() { return { titleTemplate: "%s – Hajar", + twitter: { + handle: "@sikka_sa", + }, }; }, - chat: { - link: "https://discord.com", - }, + // chat: { + // link: "https://discord.com", + // }, footer: { - text: "Nextra Docs Template", + component: ( +