756b365adf
* Add start of Sanity CMS example * Update cover-image * Clean up example * Apply suggestions from code review Co-Authored-By: Shu Uesugi <shu@chibicode.com> * Make changes from review * Remove extra style * Apply suggestions from code review Co-Authored-By: Shu Uesugi <shu@chibicode.com> * Make tweaks for preview mode and normalize env naming * Update viewing preview step * Delete author.jpg * Delete image.jpg * Update README * Fix environment variable names * Project ID is needed by lambda * Improved steps * Fixed issue with the project URL example * Clarify line * Get the preview post correctly * preview = false * Get unique posts * Show preview mode on index page * typo fix and use next latest * Added related examples section Co-authored-by: Shu Uesugi <shu@chibicode.com> Co-authored-by: Luis Alvarez <luis@zeit.co>
31 lines
797 B
JavaScript
31 lines
797 B
JavaScript
import Avatar from '../components/avatar'
|
|
import Date from '../components/date'
|
|
import CoverImage from './cover-image'
|
|
import Link from 'next/link'
|
|
|
|
export default function PostPreview({
|
|
title,
|
|
coverImage,
|
|
date,
|
|
excerpt,
|
|
author,
|
|
slug,
|
|
}) {
|
|
return (
|
|
<div>
|
|
<div className="mb-5">
|
|
<CoverImage slug={slug} title={title} url={coverImage} />
|
|
</div>
|
|
<h3 className="text-3xl mb-3 leading-snug">
|
|
<Link as={`/posts/${slug}`} href="/posts/[slug]">
|
|
<a className="hover:underline">{title}</a>
|
|
</Link>
|
|
</h3>
|
|
<div className="text-lg mb-4">
|
|
<Date dateString={date} />
|
|
</div>
|
|
<p className="text-lg leading-relaxed mb-4">{excerpt}</p>
|
|
<Avatar name={author.name} picture={author.picture} />
|
|
</div>
|
|
)
|
|
}
|