|
| 1 | +import PageTitle from '@/components/PageTitle' |
| 2 | +import { format } from 'date-fns' |
| 3 | +import Link from 'next/link' |
| 4 | + |
1 | 5 | export default function Post({ meta, children }) {
|
2 | 6 | return (
|
3 |
| - <div> |
4 |
| - <h1>{meta.title}</h1> |
5 |
| - <div> |
6 |
| - {meta.authors.map((author) => ( |
7 |
| - <img key={author.twitter} src={author.avatar} alt={author.name} /> |
8 |
| - ))} |
| 7 | + <article className="xl:divide-y xl:divide-gray-200"> |
| 8 | + <header className="xl:pb-10"> |
| 9 | + <div className="space-y-1"> |
| 10 | + <div> |
| 11 | + <div className="text-sm uppercase font-medium leading-6 text-teal-500 tracking-wide"> |
| 12 | + <Link href="/"> |
| 13 | + <a>News</a> |
| 14 | + </Link> |
| 15 | + </div> |
| 16 | + <PageTitle>{meta.title}</PageTitle> |
| 17 | + </div> |
| 18 | + <dl className="space-y-10"> |
| 19 | + <div> |
| 20 | + <dt className="sr-only">Published on</dt> |
| 21 | + <dd className="text-base leading-6 font-medium text-gray-500"> |
| 22 | + <time dateTime={meta.date}>{format(new Date(meta.date), 'EEEE, LLLL d, y')}</time> |
| 23 | + </dd> |
| 24 | + </div> |
| 25 | + </dl> |
| 26 | + </div> |
| 27 | + </header> |
| 28 | + <div |
| 29 | + className="divide-y xl:divide-y-0 divide-gray-200 xl:grid xl:grid-cols-4 xl:col-gap-6 pb-16 xl:pb-20" |
| 30 | + style={{ gridTemplateRows: 'auto 1fr' }} |
| 31 | + > |
| 32 | + <dl className="py-10 xl:border-b xl:border-gray-200"> |
| 33 | + <dt className="sr-only">Authors</dt> |
| 34 | + <dd> |
| 35 | + <ul className="flex xl:block space-x-8 sm:space-x-12 xl:space-x-0 xl:space-y-8"> |
| 36 | + {meta.authors.map((author) => ( |
| 37 | + <li key={author.twitter} className="flex items-center space-x-2"> |
| 38 | + <img src={author.avatar} alt="" className="w-10 h-10 rounded-full" /> |
| 39 | + <dl className="text-sm font-medium leading-5 whitespace-no-wrap"> |
| 40 | + <dt className="sr-only">Name</dt> |
| 41 | + <dd className="text-gray-900">{author.name}</dd> |
| 42 | + <dt className="sr-only">Twitter</dt> |
| 43 | + <dd> |
| 44 | + <a href={`https://twitter.com/${author.twitter}`} className="text-teal-500"> |
| 45 | + {author.twitter} |
| 46 | + </a> |
| 47 | + </dd> |
| 48 | + </dl> |
| 49 | + </li> |
| 50 | + ))} |
| 51 | + </ul> |
| 52 | + </dd> |
| 53 | + </dl> |
| 54 | + <div className="py-10 xl:pb-0 xl:col-span-3 xl:row-span-2">{children}</div> |
| 55 | + <footer className="text-sm font-medium leading-5 divide-y divide-gray-200 xl:col-start-1 xl:row-start-2"> |
| 56 | + <div className="space-y-8 py-8"> |
| 57 | + <div> |
| 58 | + <h2 className="text-xs tracking-wide uppercase text-gray-500">Next Article</h2> |
| 59 | + <div className="text-teal-500"> |
| 60 | + <Link href="/"> |
| 61 | + <a>Introducing the official IntelliSense VS Code Plugin</a> |
| 62 | + </Link> |
| 63 | + </div> |
| 64 | + </div> |
| 65 | + <div> |
| 66 | + <h2 className="text-xs tracking-wide uppercase text-gray-500">Previous Article</h2> |
| 67 | + <div className="text-teal-500"> |
| 68 | + <Link href="/"> |
| 69 | + <a>Introducing the official IntelliSense VS Code Plugin</a> |
| 70 | + </Link> |
| 71 | + </div> |
| 72 | + </div> |
| 73 | + </div> |
| 74 | + <div className="pt-8"> |
| 75 | + <Link href="/"> |
| 76 | + <a className="text-teal-500">View all posts</a> |
| 77 | + </Link> |
| 78 | + </div> |
| 79 | + </footer> |
9 | 80 | </div>
|
10 |
| - {children} |
11 |
| - </div> |
| 81 | + </article> |
12 | 82 | )
|
13 | 83 | }
|
0 commit comments