33import { CldImage } from "next-cloudinary" ;
44import type { Author } from "@/sanity/types" ;
55import Link from "next/link" ;
6+ import { stegaClean } from "@sanity/client/stega" ;
7+
68
79interface Props {
810 name ?: string ;
@@ -21,15 +23,16 @@ export default function Avatar({
2123 width,
2224 height,
2325} : Props ) {
24- if ( ! href && coverImage ?. public_id ) {
26+ const source = stegaClean ( coverImage ) ;
27+ if ( ! href && source ?. public_id ) {
2528 return (
2629 < div className = { `${ imgSize ? imgSize : "w-12 h-12 mr-4" } ` } >
2730 < CldImage
2831 className = "w-full h-auto aspect-square rounded-md object-cover"
2932 width = { width || 48 }
3033 height = { height || 48 }
31- alt = { coverImage ?. context ?. custom ?. alt || "" }
32- src = { coverImage . public_id }
34+ alt = { source ?. context ?. custom ?. alt || "" }
35+ src = { source . public_id }
3336 config = { {
3437 url : {
3538 secureDistribution : "media.codingcat.dev" ,
@@ -40,17 +43,17 @@ export default function Avatar({
4043 </ div >
4144 ) ;
4245 }
43- if ( href && coverImage ?. public_id ) {
46+ if ( href && source ?. public_id ) {
4447 return (
4548 < Link className = "flex items-center text-xl" href = { href } >
46- { coverImage ?. public_id && (
49+ { source ?. public_id && (
4750 < div className = { `${ imgSize ? imgSize : "w-12 h-12 mr-4" } ` } >
4851 < CldImage
4952 className = "w-full h-auto aspect-square rounded-md object-cover"
5053 width = { width || 48 }
5154 height = { height || 48 }
52- alt = { coverImage ?. context ?. custom ?. alt || "" }
53- src = { coverImage . public_id }
55+ alt = { source ?. context ?. custom ?. alt || "" }
56+ src = { source . public_id }
5457 config = { {
5558 url : {
5659 secureDistribution : "media.codingcat.dev" ,
0 commit comments