d3704a66f8
* added graphcms * Updated readme and environment variables * Removed gitignore * Updated tailwind config * Some fixes in pages * Updated api endpoints * lint fix * Updated readme * Updated og image * Updated cms examples to include this one * Added example to docs * Added preview demo link * Updated step Co-authored-by: Luis Alvarez <luis@vercel.com>
28 lines
599 B
JavaScript
28 lines
599 B
JavaScript
import cn from 'classnames'
|
|
import Link from 'next/link'
|
|
|
|
export default function CoverImage({ title, url, slug }) {
|
|
const image = (
|
|
<img
|
|
width={2000}
|
|
height={1000}
|
|
alt={`Cover Image for ${title}`}
|
|
className={cn('shadow-small', {
|
|
'hover:shadow-medium transition-shadow duration-200': slug,
|
|
})}
|
|
src={url}
|
|
/>
|
|
)
|
|
|
|
return (
|
|
<div className="-mx-5 sm:mx-0">
|
|
{slug ? (
|
|
<Link as={`/posts/${slug}`} href="/posts/[slug]">
|
|
<a aria-label={title}>{image}</a>
|
|
</Link>
|
|
) : (
|
|
image
|
|
)}
|
|
</div>
|
|
)
|
|
}
|