This commit is contained in:
Joe 2022-11-28 12:22:14 +00:00
commit de2fd802b3
2 changed files with 6 additions and 14 deletions

View File

@ -1,12 +1,11 @@
import { Breadcrumb, BreadcrumbItem, BreadcrumbLink } from '@chakra-ui/react'; import { Breadcrumb, BreadcrumbItem, BreadcrumbLink } from '@chakra-ui/react';
import NextLink from 'next/link'; import NextLink from 'next/link';
import { useRouter } from 'next/router';
import { FC } from 'react'; import { FC } from 'react';
interface Props { export const Breadcrumbs: FC = () => {
router: any; const router = useRouter();
}
export const Breadcrumbs: FC<Props> = ({ router }) => {
let pathSplit = router.asPath.split('/'); let pathSplit = router.asPath.split('/');
pathSplit = pathSplit.splice(1, pathSplit.length); pathSplit = pathSplit.splice(1, pathSplit.length);

View File

@ -6,12 +6,10 @@ import { Heading, Stack } from '@chakra-ui/react';
import MDXComponents from '../components/'; import MDXComponents from '../components/';
import { ParsedUrlQuery } from 'querystring'; import { ParsedUrlQuery } from 'querystring';
import type { GetStaticPaths, GetStaticProps, NextPage } from 'next'; import type { GetStaticPaths, GetStaticProps, NextPage } from 'next';
import { useRouter } from 'next/router'; import { Breadcrumbs } from '../components/docs';
import { Breadcrumbs } from '../components/docs'
import { PageMetadata } from '../components/UI'; import { PageMetadata } from '../components/UI';
const MATTER_OPTIONS = { const MATTER_OPTIONS = {
engines: { engines: {
yaml: (s: any) => yaml.load(s, { schema: yaml.JSON_SCHEMA }) as object yaml: (s: any) => yaml.load(s, { schema: yaml.JSON_SCHEMA }) as object
@ -73,18 +71,13 @@ interface Props {
} }
const DocPage: NextPage<Props> = ({ frontmatter, content }) => { const DocPage: NextPage<Props> = ({ frontmatter, content }) => {
const router = useRouter()
return ( return (
<> <>
<PageMetadata <PageMetadata title={frontmatter.title} description={frontmatter.description} />
title={frontmatter.title}
description={frontmatter.description}
/>
<main> <main>
<Stack py={8} px={4}> <Stack py={8} px={4}>
<Breadcrumbs router={router} /> <Breadcrumbs />
<Heading as='h1'>{frontmatter.title}</Heading> <Heading as='h1'>{frontmatter.title}</Heading>