From a8278137bf7d8b68a06d17ebeb9380071490b4c9 Mon Sep 17 00:00:00 2001 From: Nick Redmark Date: Wed, 3 Apr 2024 13:23:29 +0200 Subject: [PATCH] feat: Docs (#153) * feat: Deploy docs --------- Co-authored-by: Nicola Marcacci Rossi --- .github/workflows/release.yml | 22 ++++++ docs/docs/tutorial.md | 8 ++- docs/docusaurus.config.ts | 2 +- .../src/components/HomepageFeatures/index.tsx | 70 +++++++++++++++++++ .../HomepageFeatures/styles.module.css | 11 +++ docs/src/pages/index.tsx | 2 +- docs/src/pages/markdown-page.md | 7 -- 7 files changed, 112 insertions(+), 10 deletions(-) create mode 100644 docs/src/components/HomepageFeatures/index.tsx create mode 100644 docs/src/components/HomepageFeatures/styles.module.css delete mode 100644 docs/src/pages/markdown-page.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e8c974e..cad4353 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,3 +22,25 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + persist-credentials: false + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: '20' + - name: Install and Build + run: | + cd docs + npm install + npm run build + - name: Deploy + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: gh-pages + folder: docs/build + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/docs/tutorial.md b/docs/docs/tutorial.md index 8de5033..7d9a2ae 100644 --- a/docs/docs/tutorial.md +++ b/docs/docs/tutorial.md @@ -345,8 +345,9 @@ export const GET_POSTS = gql` ``` {me && } - ``` +``` +``` async function CreatePost() { async function createPost(formData: FormData) { 'use server' @@ -377,7 +378,9 @@ async function CreatePost() { } +``` +``` async function Posts() { const { data: { posts } } = await executeGraphql({ query: GET_POSTS }) @@ -397,7 +400,9 @@ async function Posts() { )} } +``` +``` function CreateComment({ postId }: { postId: string }) { async function createComment(formData: FormData) { 'use server' @@ -423,3 +428,4 @@ function CreateComment({ postId }: { postId: string }) { } +``` diff --git a/docs/docusaurus.config.ts b/docs/docusaurus.config.ts index 12e2cf5..89c2b18 100644 --- a/docs/docusaurus.config.ts +++ b/docs/docusaurus.config.ts @@ -71,7 +71,7 @@ const config: Config = { items: [ { label: 'Docs', - to: '/docs/intro', + to: '/docs/tutorial', }, ], }, diff --git a/docs/src/components/HomepageFeatures/index.tsx b/docs/src/components/HomepageFeatures/index.tsx new file mode 100644 index 0000000..50a9e6f --- /dev/null +++ b/docs/src/components/HomepageFeatures/index.tsx @@ -0,0 +1,70 @@ +import clsx from 'clsx'; +import Heading from '@theme/Heading'; +import styles from './styles.module.css'; + +type FeatureItem = { + title: string; + Svg: React.ComponentType>; + description: JSX.Element; +}; + +const FeatureList: FeatureItem[] = [ + { + title: 'Easy to Use', + Svg: require('@site/static/img/undraw_docusaurus_mountain.svg').default, + description: ( + <> + Docusaurus was designed from the ground up to be easily installed and + used to get your website up and running quickly. + + ), + }, + { + title: 'Focus on What Matters', + Svg: require('@site/static/img/undraw_docusaurus_tree.svg').default, + description: ( + <> + Docusaurus lets you focus on your docs, and we'll do the chores. Go + ahead and move your docs into the docs directory. + + ), + }, + { + title: 'Powered by React', + Svg: require('@site/static/img/undraw_docusaurus_react.svg').default, + description: ( + <> + Extend or customize your website layout by reusing React. Docusaurus can + be extended while reusing the same header and footer. + + ), + }, +]; + +function Feature({title, Svg, description}: FeatureItem) { + return ( +
+
+ +
+
+ {title} +

{description}

+
+
+ ); +} + +export default function HomepageFeatures(): JSX.Element { + return ( +
+
+
+ {FeatureList.map((props, idx) => ( + + ))} +
+
+
+ ); +} diff --git a/docs/src/components/HomepageFeatures/styles.module.css b/docs/src/components/HomepageFeatures/styles.module.css new file mode 100644 index 0000000..b248eb2 --- /dev/null +++ b/docs/src/components/HomepageFeatures/styles.module.css @@ -0,0 +1,11 @@ +.features { + display: flex; + align-items: center; + padding: 2rem 0; + width: 100%; +} + +.featureSvg { + height: 200px; + width: 200px; +} diff --git a/docs/src/pages/index.tsx b/docs/src/pages/index.tsx index 787b0ac..3a05659 100644 --- a/docs/src/pages/index.tsx +++ b/docs/src/pages/index.tsx @@ -17,7 +17,7 @@ function HomepageHeader() {

{siteConfig.tagline}

- + To the docs
diff --git a/docs/src/pages/markdown-page.md b/docs/src/pages/markdown-page.md deleted file mode 100644 index 9756c5b..0000000 --- a/docs/src/pages/markdown-page.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Markdown page example ---- - -# Markdown page example - -You don't need React to write simple standalone pages.