Files
Cody OlsenandGitHub 41019c2314 Update Sanity example for App Router (#63045)
This PR updates the `cms-sanity` example to use:
- App Router
- TypeScript
- Sanity Studio v3 instead of v2
- Embeds the Studio inside the next app on the `/studio` route.
- ISR / Data Cache (revalidations through `revalidatePath` while in Live
Visual Editing, time-based to match the Sanity API CDN in production).
- Support Vercel Visual Editing out of the box.
- The new `next-sanity/image` component.
- Vercel Speed Insights.
- The Sanity Presentation Tool for live content previews.
- Sanity Portable Text setup to fully support `@tailwindcss/typography`.
- [AI Assist](https://www.sanity.io/docs/ai-assist)
  - Auto fill in `alt` text on images.
  - Preset prompts for content creation
2024-03-10 19:49:18 -07:00

32 lines
850 B
TypeScript

import { Image } from "next-sanity/image";
import { Author } from "@/sanity/lib/queries";
import { urlForImage } from "@/sanity/lib/utils";
export default function Avatar({ name, picture }: Author) {
return (
<div className="flex items-center text-xl">
{picture?.asset?._ref ? (
<div className="mr-4 h-12 w-12">
<Image
alt={picture?.alt || ""}
className="h-full rounded-full object-cover"
height={48}
width={48}
src={
urlForImage(picture)
?.height(96)
.width(96)
.fit("crop")
.url() as string
}
/>
</div>
) : (
<div className="mr-1">By </div>
)}
<div className="text-pretty text-xl font-bold">{name}</div>
</div>
);
}