From 2c1f2adcf8a854cfd3353a887a224add2fc66824 Mon Sep 17 00:00:00 2001 From: sup39 Date: Fri, 4 Nov 2022 21:44:29 +0900 Subject: [PATCH] init --- .gitignore | 2 + LICENSE | 21 + README.md | 5 + components/Footer.tsx | 10 + components/MDXRoot.tsx | 35 + components/MetaInfo.tsx | 12 + components/Nav.tsx | 53 + components/NavHeader.tsx | 10 + components/mdx.tsx | 12 + next-env.d.ts | 5 + next.config.mjs | 30 + package.json | 67 + pages/_app.tsx | 20 + pages/index.mdx | 8 + styles/a.sass | 27 + styles/code.sass | 23 + styles/heading.sass | 35 + styles/index.sass | 11 + styles/menu-toggle.sass | 37 + styles/misc.sass | 261 +++ styles/nav.pc.sass | 32 + styles/nav.sass | 107 ++ styles/span.sass | 29 + styles/vars.sass | 10 + supMDX-env.d.ts | 16 + supMDX.yml | 7 + tsconfig.json | 37 + yarn.lock | 3233 ++++++++++++++++++++++++++++++++++++++ 28 files changed, 4155 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 components/Footer.tsx create mode 100644 components/MDXRoot.tsx create mode 100644 components/MetaInfo.tsx create mode 100644 components/Nav.tsx create mode 100644 components/NavHeader.tsx create mode 100644 components/mdx.tsx create mode 100644 next-env.d.ts create mode 100644 next.config.mjs create mode 100644 package.json create mode 100644 pages/_app.tsx create mode 100644 pages/index.mdx create mode 100644 styles/a.sass create mode 100644 styles/code.sass create mode 100644 styles/heading.sass create mode 100644 styles/index.sass create mode 100644 styles/menu-toggle.sass create mode 100644 styles/misc.sass create mode 100644 styles/nav.pc.sass create mode 100644 styles/nav.sass create mode 100644 styles/span.sass create mode 100644 styles/vars.sass create mode 100644 supMDX-env.d.ts create mode 100644 supMDX.yml create mode 100644 tsconfig.json create mode 100644 yarn.lock diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57ff971 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules/ +.next/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c85a4d5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 sup39 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..aa97380 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# supMDX +A template to make blog-like site with MDX + +## Configuration +- `supMDX.yml` diff --git a/components/Footer.tsx b/components/Footer.tsx new file mode 100644 index 0000000..da64091 --- /dev/null +++ b/components/Footer.tsx @@ -0,0 +1,10 @@ +import config from '#config'; + +export default function Footer() { + const {startYear: year0, siteAuthor} = config; + const year = new Date().getFullYear(); + + return ; +} diff --git a/components/MDXRoot.tsx b/components/MDXRoot.tsx new file mode 100644 index 0000000..c83be36 --- /dev/null +++ b/components/MDXRoot.tsx @@ -0,0 +1,35 @@ +import Head from 'next/head'; +import Nav from './Nav'; +import MetaInfo from './MetaInfo'; +import type {HeadingInfo} from '@sup39/rehype-mdx-export-headings'; + +export type MDXProps = { + children: JSX.Element + data: { + pathname: string, + }, + meta: Partial<{ + title: string + description: string + h1: string + [key: string]: any + }> + headings: HeadingInfo[] +}; + +export default function MDXRoot({children, data: {pathname}, meta={}, headings}: MDXProps) { + const {title, description} = meta; + const h1 = meta.h1 ?? title; + return <> + + {title} + {description && } + +