1
+ import { useTheme } from "@emotion/react" ;
1
2
import * as AvatarPrimitive from "@radix-ui/react-avatar" ;
2
3
import { type VariantProps , cva } from "class-variance-authority" ;
3
4
/**
@@ -9,6 +10,7 @@ import { type VariantProps, cva } from "class-variance-authority";
9
10
* @see {@link https://www.figma.com/design/WfqIgsTFXN2BscBSSyXWF8/Coder-kit?node-id=711-383&t=xqxOSUk48GvDsjGK-0 }
10
11
*/
11
12
import * as React from "react" ;
13
+ import { getExternalImageStylesFromUrl } from "theme/externalImages" ;
12
14
import { cn } from "utils/cn" ;
13
15
14
16
const avatarVariants = cva (
@@ -67,13 +69,18 @@ Avatar.displayName = AvatarPrimitive.Root.displayName;
67
69
const AvatarImage = React . forwardRef <
68
70
React . ElementRef < typeof AvatarPrimitive . Image > ,
69
71
React . ComponentPropsWithoutRef < typeof AvatarPrimitive . Image >
70
- > ( ( { className, ...props } , ref ) => (
71
- < AvatarPrimitive . Image
72
- ref = { ref }
73
- className = { cn ( "aspect-square h-full w-full object-contain" , className ) }
74
- { ...props }
75
- />
76
- ) ) ;
72
+ > ( ( { className, ...props } , ref ) => {
73
+ const theme = useTheme ( ) ;
74
+
75
+ return (
76
+ < AvatarPrimitive . Image
77
+ ref = { ref }
78
+ className = { cn ( "aspect-square h-full w-full object-contain" , className ) }
79
+ css = { getExternalImageStylesFromUrl ( theme . externalImages , props . src ) }
80
+ { ...props }
81
+ />
82
+ ) ;
83
+ } ) ;
77
84
AvatarImage . displayName = AvatarPrimitive . Image . displayName ;
78
85
79
86
const AvatarFallback = React . forwardRef <
0 commit comments