-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add markdown and data fetching
- Loading branch information
1 parent
fd37423
commit c8c0be2
Showing
35 changed files
with
581 additions
and
5,088 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,6 @@ pnpm-debug.log* | |
|
||
# macOS-specific files | ||
.DS_Store | ||
.netlify | ||
.netlify | ||
|
||
generated/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
schema: | ||
- 'https://api.ham-san.net/graphql' | ||
|
||
documents: | ||
- ../../libs/graphql/**/*.gql | ||
|
||
generates: | ||
src/graphql/generated/client.ts: | ||
plugins: | ||
- 'typescript' | ||
- 'typescript-operations' | ||
- 'typescript-graphql-request' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
schema: | ||
- 'http://127.0.0.1:1337/graphql' | ||
|
||
documents: | ||
- ../../libs/graphql/**/*.gql | ||
|
||
generates: | ||
src/graphql/generated/server.ts: | ||
plugins: | ||
- 'typescript' | ||
- 'typescript-operations' | ||
- 'typescript-graphql-request' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import ReactMarkdown from 'react-markdown'; | ||
import remarkGfm from 'remark-gfm'; | ||
import remarkTextr from 'remark-textr'; | ||
import { Divider, styled } from 'styled-system/jsx'; | ||
import { Code } from '../ui/code'; | ||
import { Heading } from '../ui/heading'; | ||
import { Link } from '../ui/link'; | ||
import * as Table from '../ui/table'; | ||
import { Text } from '../ui/text'; | ||
// https://github.com/remarkjs/react-markdown | ||
export const Markdown = ({ content }: { content: string }) => { | ||
return ( | ||
<ReactMarkdown | ||
remarkPlugins={[remarkTextr, remarkGfm]} | ||
components={{ | ||
h1: ({ node: _, ...props }) => <Heading as="h1" size="6xl" fontWeight="bold" {...props} />, | ||
h2: ({ node: _, ...props }) => <Heading as="h2" size="5xl" fontWeight="bold" {...props} />, | ||
h3: ({ node: _, ...props }) => <Heading as="h3" size="4xl" fontWeight="bold" {...props} />, | ||
h4: ({ node: _, ...props }) => <Heading as="h4" size="3xl" fontWeight="bold" {...props} />, | ||
h5: ({ node: _, ...props }) => <Heading as="h5" size="2xl" fontWeight="bold" {...props} />, | ||
h6: ({ node: _, ...props }) => <Heading as="h6" size="xl" fontWeight="bold" {...props} />, | ||
p: ({ node: _, ...props }) => <Text as="p" {...props} />, | ||
strong: ({ ref: _, node: __, ...props }) => <Text as="span" fontWeight="bold" {...props} />, | ||
a: ({ ref: _, node: __, ...props }) => <Link {...props} />, | ||
hr: ({ ref: _, node: __, ...props }) => <Divider {...props} />, | ||
blockquote: ({ ref: __, node: _, ...props }) => ( | ||
<styled.blockquote | ||
borderLeftWidth="4px" | ||
borderLeftStyle="solid" | ||
borderLeftColor="border.default" | ||
padding={4} | ||
{...props} | ||
/> | ||
), | ||
ul: ({ ref: _, node: __, ...props }) => ( | ||
<styled.ul pl="4" listStyleType="disc" {...props} /> | ||
), | ||
ol: ({ ref: _, node: __, ...props }) => ( | ||
<styled.ol pl="4" listStyleType="decimal" {...props} /> | ||
), | ||
li: ({ ref: _, node: __, ...props }) => <styled.li {...props} />, | ||
code: ({ ref: _, node: __, ...props }) => <Code {...props} />, | ||
table: ({ ref: _, node: __, ...props }) => <Table.Root {...props} />, | ||
thead: ({ ref: _, node: __, ...props }) => <Table.Head {...props} />, | ||
th: ({ ref: _, node: __, ...props }) => <Table.Header {...props} />, | ||
tbody: ({ ref: _, node: __, ...props }) => <Table.Body {...props} />, | ||
tr: ({ ref: _, node: __, ...props }) => <Table.Row {...props} />, | ||
td: ({ ref: _, node: __, ...props }) => <Table.Cell {...props} /> | ||
}} | ||
> | ||
{/* {data} */} | ||
{content} | ||
</ReactMarkdown> | ||
); | ||
}; |
Oops, something went wrong.