Skip to content

Commit

Permalink
Adjust typescript stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
jonrohan committed Sep 11, 2024
1 parent f57fa17 commit 46da581
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/react/src/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,13 @@ const Avatar = React.forwardRef<HTMLImageElement, AvatarProps>(function Avatar(
: merge({'--avatar-size': `${size}px`} as React.CSSProperties, sxProp as SxProp)

if (enabled) {
const cssSizeVars = {} as React.CSSProperties
const cssSizeVars = {} as Record<string, string>

if (isResponsive) {
for (const [key, value] of Object.entries(size)) {
// @ts-ignore - css property
cssSizeVars[`--avatarSize-${key}`] = `${value}px`
}
} else {
// @ts-ignore - css property
cssSizeVars['--avatarSize-regular'] = `${size}px`
}

Expand All @@ -87,7 +85,7 @@ const Avatar = React.forwardRef<HTMLImageElement, AvatarProps>(function Avatar(
width={isResponsive ? undefined : size}
height={isResponsive ? undefined : size}
// @ts-ignore - it's not allowing CSS properties here
style={cssSizeVars}
style={cssSizeVars as React.CSSProperties}
sx={sxProp}
{...rest}
/>
Expand All @@ -104,7 +102,7 @@ const Avatar = React.forwardRef<HTMLImageElement, AvatarProps>(function Avatar(
width={isResponsive ? undefined : size}
height={isResponsive ? undefined : size}
// @ts-ignore - it's not allowing CSS properties here
style={cssSizeVars}
style={cssSizeVars as React.CSSProperties}
{...rest}
/>
)
Expand Down

0 comments on commit 46da581

Please sign in to comment.