diff --git a/src/components/MDXComponents.tsx b/src/components/MDXComponents.tsx index 18129b3369..e5296c99fa 100644 --- a/src/components/MDXComponents.tsx +++ b/src/components/MDXComponents.tsx @@ -3,6 +3,8 @@ import NextLink from 'next/link'; import { PrismLight as SyntaxHighlighter } from 'react-syntax-highlighter'; import { nightOwl, prism } from 'react-syntax-highlighter/dist/cjs/styles/prism'; +// import { Code } from './UI/docs' + import bash from 'react-syntax-highlighter/dist/cjs/languages/prism/bash'; import go from 'react-syntax-highlighter/dist/cjs/languages/prism/go'; import graphql from 'react-syntax-highlighter/dist/cjs/languages/prism/graphql'; diff --git a/src/components/UI/docs/Code.tsx b/src/components/UI/docs/Code.tsx new file mode 100644 index 0000000000..7be53c6ac6 --- /dev/null +++ b/src/components/UI/docs/Code.tsx @@ -0,0 +1,38 @@ +// Libraries +import { Code as ChakraCode, Stack, Text } from '@chakra-ui/react'; +import { FC } from 'react'; + +interface Props { + code: any; +} + +export const Code: FC = ({ code }) => { + return ( + !!code.inline ? + ( + + {code.children[0]} + + ) + : + ( + + + {code.children[0]} + + + ) + ); +}; diff --git a/src/components/UI/docs/index.tsx b/src/components/UI/docs/index.tsx new file mode 100644 index 0000000000..823cfaea66 --- /dev/null +++ b/src/components/UI/docs/index.tsx @@ -0,0 +1 @@ +export * from './Code'; \ No newline at end of file diff --git a/src/components/docs/Breadcrumbs.tsx b/src/components/docs/Breadcrumbs.tsx new file mode 100644 index 0000000000..74c323322f --- /dev/null +++ b/src/components/docs/Breadcrumbs.tsx @@ -0,0 +1,28 @@ +import { Breadcrumb, BreadcrumbItem, BreadcrumbLink } from '@chakra-ui/react'; +import NextLink from 'next/link'; +import { FC } from 'react'; + +interface Props { + router: any; +} + +export const Breadcrumbs: FC = ({ router }) => { + let pathSplit = router.asPath.split('/'); + pathSplit = pathSplit.splice(1, pathSplit.length); + + return ( + + {pathSplit.map((path: string, idx: number) => { + return ( + + + + {path} + + + + ); + })} + + ); +}; diff --git a/src/components/docs/index.ts b/src/components/docs/index.ts new file mode 100644 index 0000000000..381317adf2 --- /dev/null +++ b/src/components/docs/index.ts @@ -0,0 +1 @@ +export * from './Breadcrumbs' \ No newline at end of file diff --git a/src/pages/[...slug].tsx b/src/pages/[...slug].tsx index d391271a16..4215cbc37c 100644 --- a/src/pages/[...slug].tsx +++ b/src/pages/[...slug].tsx @@ -1,15 +1,20 @@ import fs from 'fs'; import matter from 'gray-matter'; import yaml from 'js-yaml'; -import ReactMarkdown from 'react-markdown'; import { Stack, Heading } from '@chakra-ui/react'; -import MDXComponents from '../components/'; -import { ParsedUrlQuery } from 'querystring'; -import type { GetStaticPaths, GetStaticProps, NextPage } from 'next'; -import { textStyles } from '../theme/foundations'; import ChakraUIRenderer from 'chakra-ui-markdown-renderer'; +import ReactMarkdown from 'react-markdown'; import gfm from 'remark-gfm'; +import { ParsedUrlQuery } from 'querystring'; +import type { GetStaticPaths, GetStaticProps, NextPage } from 'next'; +import { useRouter } from 'next/router'; + +import MDXComponents from '../components/'; +import { Breadcrumbs } from '../components/docs' import { PageMetadata } from '../components/UI'; +import { textStyles } from '../theme/foundations'; + + const MATTER_OPTIONS = { engines: { @@ -72,6 +77,8 @@ interface Props { } const DocPage: NextPage = ({ frontmatter, content }) => { + const router = useRouter() + return ( <> = ({ frontmatter, content }) => {
- {/* TODO: */} + {frontmatter.title} diff --git a/src/theme/foundations/textStyles.ts b/src/theme/foundations/textStyles.ts index f0ad126aa2..a80270f338 100644 --- a/src/theme/foundations/textStyles.ts +++ b/src/theme/foundations/textStyles.ts @@ -134,6 +134,20 @@ export const textStyles = { textAlign: 'center', fontSize: 'sm' }, + 'inline-code-snippet': { + fontFamily: '"JetBrains Mono", monospace', + fontWeight: 400, + fontSize: 'md', + lineHeight: 4, + letterSpacing: '1%' + }, + 'code-block': { + fontFamily: '"JetBrains Mono", monospace', + fontWeight: 400, + fontSize: 'md', + lineHeight: '21.12px', + letterSpacing: '1%' + }, // TODO: refactor w/ semantic tokens for light/dark mode 'link-light': {}, // TODO: refactor w/ semantic tokens for light/dark mode diff --git a/src/theme/index.ts b/src/theme/index.ts index a9a91ae289..a81404ae18 100644 --- a/src/theme/index.ts +++ b/src/theme/index.ts @@ -30,7 +30,8 @@ const overrides = { body: { _light: 'gray.800', _dark: 'yellow.50' }, 'code-bg': { _light: 'gray.200', _dark: 'gray.700' }, 'code-bg-contrast': { _light: 'gray.800', _dark: 'gray.900' }, - bg: { _light: 'yellow.50', _dark: 'gray.800' } + 'code-text': { _light: 'green.50', _dark: 'green.50' }, + bg: { _light: 'yellow.50', _dark: 'gray.800' }, } } }; diff --git a/src/utils/index.ts b/src/utils/index.ts deleted file mode 100644 index e3d2a70842..0000000000 --- a/src/utils/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './getProgrammingLanguageName';