Unverified Commit 9d281421 authored by @whitep4nth3r's avatar @whitep4nth3r Committed by GitHub

Update examples/cms-contentful (#29641)

* Use custom image loader and update deps

* Revert contentful-import downgrade

* bump
parent 39b30e5e
import Image from 'next/image' import ContentfulImage from './contentful-image'
export default function Avatar({ name, picture }) { export default function Avatar({ name, picture }) {
return ( return (
<div className="flex items-center"> <div className="flex items-center">
<div className="w-12 h-12 relative mr-4"> <div className="relative w-12 h-12 mr-4">
<Image <ContentfulImage
src={picture.url} src={picture.url}
layout="fill" layout="fill"
className="rounded-full" className="rounded-full"
......
import Image from 'next/image'
const contentfulLoader = ({ src, width, quality }) => {
return `${src}?w=${width}&q=${quality || 75}`
}
const ContentfulImage = (props) => {
return <Image loader={contentfulLoader} {...props} />
}
export default ContentfulImage
import Image from 'next/image' import ContentfulImage from './contentful-image'
import Link from 'next/link' import Link from 'next/link'
import cn from 'classnames' import cn from 'classnames'
export default function CoverImage({ title, url, slug }) { export default function CoverImage({ title, url, slug }) {
const image = ( const image = (
<Image <ContentfulImage
width={2000} width={2000}
height={1000} height={1000}
alt={`Cover Image for ${title}`} alt={`Cover Image for ${title}`}
......
module.exports = {
images: {
loader: 'custom',
},
}
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
"setup": "node ./contentful/setup.js $CONTENTFUL_SPACE_ID $CONTENTFUL_MANAGEMENT_TOKEN" "setup": "node ./contentful/setup.js $CONTENTFUL_SPACE_ID $CONTENTFUL_MANAGEMENT_TOKEN"
}, },
"dependencies": { "dependencies": {
"@contentful/rich-text-react-renderer": "14.1.1", "@contentful/rich-text-react-renderer": "^15.4.0",
"classnames": "2.3.1", "classnames": "2.3.1",
"date-fns": "2.22.1", "date-fns": "2.22.1",
"next": "latest", "next": "latest",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment