upstream #1

Merged
jblu merged 1007 commits from upstream into main 2024-11-04 22:35:57 -06:00
5 changed files with 85 additions and 2 deletions
Showing only changes of commit ceb913f767 - Show all commits

View File

@ -6,6 +6,7 @@ import { allBlogs, allAuthors } from 'contentlayer/generated'
import type { Authors, Blog } from 'contentlayer/generated' import type { Authors, Blog } from 'contentlayer/generated'
import PostSimple from '@/layouts/PostSimple' import PostSimple from '@/layouts/PostSimple'
import PostLayout from '@/layouts/PostLayout' import PostLayout from '@/layouts/PostLayout'
import PostBanner from '@/layouts/PostBanner'
import { Metadata } from 'next' import { Metadata } from 'next'
import siteMetadata from '@/data/siteMetadata' import siteMetadata from '@/data/siteMetadata'
@ -14,6 +15,7 @@ const defaultLayout = 'PostLayout'
const layouts = { const layouts = {
PostSimple, PostSimple,
PostLayout, PostLayout,
PostBanner,
} }
export async function generateMetadata({ export async function generateMetadata({

View File

@ -3,11 +3,11 @@ title: O Canada
date: '2017-07-15' date: '2017-07-15'
tags: ['holiday', 'canada', 'images'] tags: ['holiday', 'canada', 'images']
draft: false draft: false
layout: PostBanner
images: ['/static/images/canada/mountains.jpg']
summary: The scenic lands of Canada featuring maple leaves, snow-capped mountains, turquoise lakes and Toronto. Take in the sights in this photo gallery exhibition and see how easy it is to replicate with some MDX magic and tailwind classes. summary: The scenic lands of Canada featuring maple leaves, snow-capped mountains, turquoise lakes and Toronto. Take in the sights in this photo gallery exhibition and see how easy it is to replicate with some MDX magic and tailwind classes.
--- ---
# O Canada
The scenic lands of Canada featuring maple leaves, snow-capped mountains, turquoise lakes and Toronto. Take in the sights in this photo gallery exhibition and see how easy it is to replicate with some MDX magic and tailwind classes. The scenic lands of Canada featuring maple leaves, snow-capped mountains, turquoise lakes and Toronto. Take in the sights in this photo gallery exhibition and see how easy it is to replicate with some MDX magic and tailwind classes.
Features images served using `next/image` component. The locally stored images are located in a folder with the following path: `/static/images/canada/[filename].jpg` Features images served using `next/image` component. The locally stored images are located in a folder with the following path: `/static/images/canada/[filename].jpg`

78
layouts/PostBanner.tsx Normal file
View File

@ -0,0 +1,78 @@
import { ReactNode } from 'react'
import Image from '@/components/Image'
import Bleed from 'pliny/ui/Bleed'
import { CoreContent } from 'pliny/utils/contentlayer'
import type { Blog } from 'contentlayer/generated'
import Comments from '@/components/Comments'
import Link from '@/components/Link'
import PageTitle from '@/components/PageTitle'
import SectionContainer from '@/components/SectionContainer'
import siteMetadata from '@/data/siteMetadata'
import ScrollTopAndComment from '@/components/ScrollTopAndComment'
interface LayoutProps {
content: CoreContent<Blog>
children: ReactNode
next?: { path: string; title: string }
prev?: { path: string; title: string }
}
export default function PostMinimal({ content, next, prev, children }: LayoutProps) {
const { slug, title, images } = content
const displayImage =
images && images.length > 0 ? images[0] : 'https://picsum.photos/seed/picsum/800/400'
return (
<SectionContainer>
<ScrollTopAndComment />
<article>
<div>
<div className="space-y-1 pb-10 text-center dark:border-gray-700">
<div className="w-full">
<Bleed>
<div className="aspect-[2/1] w-full relative">
<Image src={displayImage} alt={title} fill className="object-cover" />
</div>
</Bleed>
</div>
<div className="pt-10 relative">
<PageTitle>{title}</PageTitle>
</div>
</div>
<div className="prose max-w-none py-4 dark:prose-invert">{children}</div>
{siteMetadata.comments && (
<div className="pb-6 pt-6 text-center text-gray-700 dark:text-gray-300" id="comment">
<Comments slug={slug} />
</div>
)}
<footer>
<div className="flex flex-col text-sm font-medium sm:flex-row sm:justify-between sm:text-base">
{prev && prev.path && (
<div className="pt-4 xl:pt-8">
<Link
href={`/${prev.path}`}
className="text-primary-500 hover:text-primary-600 dark:hover:text-primary-400"
aria-label={`Previous post: ${prev.title}`}
>
&larr; {prev.title}
</Link>
</div>
)}
{next && next.path && (
<div className="pt-4 xl:pt-8">
<Link
href={`/${next.path}`}
className="text-primary-500 hover:text-primary-600 dark:hover:text-primary-400"
aria-label={`Next post: ${next.title}`}
>
{next.title} &rarr;
</Link>
</div>
)}
</div>
</footer>
</div>
</article>
</SectionContainer>
)
}

View File

@ -65,6 +65,9 @@ module.exports = () => {
eslint: { eslint: {
dirs: ['app', 'components', 'layouts', 'scripts'], dirs: ['app', 'components', 'layouts', 'scripts'],
}, },
images: {
domains: ['picsum.photos'],
},
experimental: { experimental: {
appDir: true, appDir: true,
}, },

Binary file not shown.

After

Width:  |  Height:  |  Size: 689 KiB