|
| 1 | +import { MDXProvider } from '@mdx-js/react'; |
| 2 | +import { Metadata } from 'mdx/config'; |
| 3 | +import Head from 'next/head'; |
| 4 | +import Link from 'next/link'; |
| 5 | +import { useRouter } from 'next/router'; |
| 6 | +import { ReactNode } from 'react'; |
| 7 | +import { MDXComponents } from './Mdx'; |
| 8 | + |
| 9 | +interface NoteProps { |
| 10 | + meta: Metadata; |
| 11 | + children: ReactNode; |
| 12 | +} |
| 13 | + |
| 14 | +const Note = (props: NoteProps) => { |
| 15 | + const { meta, children } = props; |
| 16 | + const router = useRouter(); |
| 17 | + const title = meta.title; |
| 18 | + return ( |
| 19 | + <main> |
| 20 | + <article className="py-16"> |
| 21 | + <Head> |
| 22 | + <title>{title} – codehex note</title> |
| 23 | + {/* <meta name="description" content={meta.description}></meta> */} |
| 24 | + <meta name="twitter:card" content="summary_large_image" /> |
| 25 | + <meta name="twitter:site" content="@codehex" /> |
| 26 | + <meta name="twitter:creator" content="@codehex" /> |
| 27 | + <meta name="twitter:title" content={`${title} – codehex note`} /> |
| 28 | + {/* <meta name="twitter:description" content={description} /> */} |
| 29 | + <meta name="twitter:card" content="summary" /> |
| 30 | + <meta |
| 31 | + name="twitter:image" |
| 32 | + content={`https://codehex.dev/assets/images/twitter-card-small.jpg`} |
| 33 | + /> |
| 34 | + <meta |
| 35 | + property="og:url" |
| 36 | + content={`https://codehex.dev${router.pathname}`} |
| 37 | + /> |
| 38 | + <meta property="og:type" content="article" /> |
| 39 | + <meta property="og:title" content={`${title} – codehex note`} /> |
| 40 | + {/* <meta property="og:description" content={description} /> */} |
| 41 | + <meta |
| 42 | + property="og:image" |
| 43 | + content={`https://codehex.dev/assets/images/twitter-card-small.jpg`} |
| 44 | + /> |
| 45 | + </Head> |
| 46 | + <div className={`w-full flex bg-white antialiased`}> |
| 47 | + <div className="min-w-0 flex-auto px-8 sm:px-10 xl:px-12 pt-10 pb-24 lg:pb-16"> |
| 48 | + <div className="pb-10 border-b border-gray-200 mb-10"> |
| 49 | + <div> |
| 50 | + <h1 className="inline-block text-3xl font-extrabold text-gray-900 tracking-tight"> |
| 51 | + {title} |
| 52 | + </h1> |
| 53 | + </div> |
| 54 | + <p className="mt-1 text-lg text-gray-500">Detail</p> |
| 55 | + </div> |
| 56 | + |
| 57 | + <MDXProvider components={{ ...MDXComponents }}> |
| 58 | + {children} |
| 59 | + </MDXProvider> |
| 60 | + <footer className="text-sm font-medium leading-5 divide-y divide-gray-200 xl:col-start-1 xl:row-start-2"> |
| 61 | + <div className="pt-8"> |
| 62 | + <Link href="/note"> |
| 63 | + <a className="text-teal-500 hover:text-teal-600"> |
| 64 | + ← Back to the note |
| 65 | + </a> |
| 66 | + </Link> |
| 67 | + </div> |
| 68 | + </footer> |
| 69 | + </div> |
| 70 | + </div> |
| 71 | + </article> |
| 72 | + </main> |
| 73 | + ); |
| 74 | +}; |
| 75 | + |
| 76 | +export default Note; |
0 commit comments