Skip to content

Commit

Permalink
feat: Docs (#153)
Browse files Browse the repository at this point in the history
* feat: Deploy docs

---------

Co-authored-by: Nicola Marcacci Rossi <[email protected]>
  • Loading branch information
nickredmark and nicola-smartive authored Apr 3, 2024
1 parent be06252 commit a827813
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 10 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
8 changes: 7 additions & 1 deletion docs/docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,9 @@ export const GET_POSTS = gql`
```
{me && <CreatePost/> }
<Posts/>
```
```

```
async function CreatePost() {
async function createPost(formData: FormData) {
'use server'
Expand Down Expand Up @@ -377,7 +378,9 @@ async function CreatePost() {
</div>
</form>
}
```

```
async function Posts() {
const { data: { posts } } = await executeGraphql<GetPostsQuery>({ query: GET_POSTS })
Expand All @@ -397,7 +400,9 @@ async function Posts() {
</div>)}
</div>
}
```

```
function CreateComment({ postId }: { postId: string }) {
async function createComment(formData: FormData) {
'use server'
Expand All @@ -423,3 +428,4 @@ function CreateComment({ postId }: { postId: string }) {
</div>
</form>
}
```
2 changes: 1 addition & 1 deletion docs/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const config: Config = {
items: [
{
label: 'Docs',
to: '/docs/intro',
to: '/docs/tutorial',
},
],
},
Expand Down
70 changes: 70 additions & 0 deletions docs/src/components/HomepageFeatures/index.tsx
Original file line number Diff line number Diff line change
@@ -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<React.ComponentProps<'svg'>>;
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&apos;ll do the chores. Go
ahead and move your docs into the <code>docs</code> 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 (
<div className={clsx('col col--4')}>
<div className="text--center">
<Svg className={styles.featureSvg} role="img" />
</div>
<div className="text--center padding-horiz--md">
<Heading as="h3">{title}</Heading>
<p>{description}</p>
</div>
</div>
);
}

export default function HomepageFeatures(): JSX.Element {
return (
<section className={styles.features}>
<div className="container">
<div className="row">
{FeatureList.map((props, idx) => (
<Feature key={idx} {...props} />
))}
</div>
</div>
</section>
);
}
11 changes: 11 additions & 0 deletions docs/src/components/HomepageFeatures/styles.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.features {
display: flex;
align-items: center;
padding: 2rem 0;
width: 100%;
}

.featureSvg {
height: 200px;
width: 200px;
}
2 changes: 1 addition & 1 deletion docs/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function HomepageHeader() {
</Heading>
<p className="hero__subtitle">{siteConfig.tagline}</p>
<div className={styles.buttons}>
<Link className="button button--secondary button--lg" to="/docs/intro">
<Link className="button button--secondary button--lg" to="/docs/tutorial">
To the docs
</Link>
</div>
Expand Down
7 changes: 0 additions & 7 deletions docs/src/pages/markdown-page.md

This file was deleted.

0 comments on commit a827813

Please sign in to comment.