From 8a6878d5ff191df4f72ed02b285e9872ae135997 Mon Sep 17 00:00:00 2001 From: sup39 Date: Thu, 16 Feb 2023 09:54:31 +0900 Subject: [PATCH] rearrange files --- components/Footer.tsx | 10 - components/MDXRoot.tsx | 40 +--- components/MetaInfo.tsx | 12 -- components/NavHeader.tsx | 12 -- components/mdx.tsx | 15 -- core/components/heading.tsx | 12 ++ core/components/index.tsx | 6 + core/components/tag.tsx | 79 ++++++++ core/nav/Nav.tsx | 25 +++ core/nav/NavBase.tsx | 30 +++ components/Nav.tsx => core/nav/NavEntry.tsx | 35 +--- core/nav/NavHeader.tsx | 36 ++++ core/nav/index.tsx | 7 + core/page/Footer.tsx | 16 ++ core/page/MDXPage.tsx | 83 ++++++++ core/page/MetaInfo.tsx | 19 ++ core/page/i18n-nav.ts | 19 ++ core/page/i18n.ts | 29 +++ core/page/index.tsx | 8 + package.json | 13 +- pages/_app.tsx | 13 +- pages/index.mdx | 12 -- supMDX-env.d.ts | 11 +- supMDX.yml | 12 +- tsconfig.json | 1 + yarn.lock | 200 ++++++++++---------- 26 files changed, 493 insertions(+), 262 deletions(-) delete mode 100644 components/Footer.tsx delete mode 100644 components/MetaInfo.tsx delete mode 100644 components/NavHeader.tsx delete mode 100644 components/mdx.tsx create mode 100644 core/components/heading.tsx create mode 100644 core/components/index.tsx create mode 100644 core/components/tag.tsx create mode 100644 core/nav/Nav.tsx create mode 100644 core/nav/NavBase.tsx rename components/Nav.tsx => core/nav/NavEntry.tsx (51%) create mode 100644 core/nav/NavHeader.tsx create mode 100644 core/nav/index.tsx create mode 100644 core/page/Footer.tsx create mode 100644 core/page/MDXPage.tsx create mode 100644 core/page/MetaInfo.tsx create mode 100644 core/page/i18n-nav.ts create mode 100644 core/page/i18n.ts create mode 100644 core/page/index.tsx diff --git a/components/Footer.tsx b/components/Footer.tsx deleted file mode 100644 index 7321a86..0000000 --- a/components/Footer.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import config from '#config'; - -export default function Footer() { - const year = new Date().getFullYear(); - const {site: {startYear: year0 = year, author} = {}} = config; - - return ; -} diff --git a/components/MDXRoot.tsx b/components/MDXRoot.tsx index a131ffc..84bb003 100644 --- a/components/MDXRoot.tsx +++ b/components/MDXRoot.tsx @@ -1,38 +1,4 @@ -import Head from 'next/head'; -import type {AppProps} from 'next/app'; -import Nav from './Nav'; -import Footer from './Footer'; -import MetaInfo from './MetaInfo'; -import type {HeadingInfo} from '@sup39/rehype-mdx-export-headings'; +import MDXPageFactory from '@sup39/mdx-page'; +import config from '#config'; -export type MDXProps = { - children: JSX.Element - router: AppProps['router'], - meta: Partial<{ - title: string - description: string - h1: string - [key: string]: any - }> - headings: HeadingInfo[] -}; - -export default function MDXRoot({children, router: {pathname}, meta={}, headings}: MDXProps) { - const {title, description} = meta; - const h1 = meta.h1 ?? title; - return <> - - {title} - {description && } - -