rsnext/examples/cms-contentful/app/avatar.tsx
Lee Robinson 0718aec93b
Update Contentful example for App Router. (#54205)
This PR updates the `cms-contentful` example to use:

- App Router
- TypeScript
- Draft Mode (previously Preview Mode)
- ISR / Data Cache (revalidations through `revalidateTag`)

Further, it combines many separate files into more manageable single files, and tries to better bucket provider-specific logic into the `lib/` folder. I'm hoping this can be the foundation for re-writing the rest of the `cms-*` examples to use App Router.

Overall, the code is much easier to reason about IMO. Pretty happy with the change. I sprinkled some `any`'s throughout here, but if someone wants to make it better, go for it! 

https://app-router-contentful.vercel.app/
2023-08-21 13:21:37 +00:00

24 lines
503 B
TypeScript

import ContentfulImage from '@/lib/contentful-image'
export default function Avatar({
name,
picture,
}: {
name: string
picture: any
}) {
return (
<div className="flex items-center">
<div className="mr-4 w-12 h-12">
<ContentfulImage
alt={name}
className="object-cover h-full rounded-full"
height={48}
width={48}
src={picture.url}
/>
</div>
<div className="text-xl font-bold">{name}</div>
</div>
)
}