Skip to content

Commit 7304999

Browse files
committed
Fix selected template avatar
1 parent f47ed9d commit 7304999

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

site/src/components/Avatar/Avatar.tsx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useTheme } from "@emotion/react";
12
import * as AvatarPrimitive from "@radix-ui/react-avatar";
23
import { type VariantProps, cva } from "class-variance-authority";
34
/**
@@ -9,6 +10,7 @@ import { type VariantProps, cva } from "class-variance-authority";
910
* @see {@link https://www.figma.com/design/WfqIgsTFXN2BscBSSyXWF8/Coder-kit?node-id=711-383&t=xqxOSUk48GvDsjGK-0}
1011
*/
1112
import * as React from "react";
13+
import { getExternalImageStylesFromUrl } from "theme/externalImages";
1214
import { cn } from "utils/cn";
1315

1416
const avatarVariants = cva(
@@ -67,13 +69,18 @@ Avatar.displayName = AvatarPrimitive.Root.displayName;
6769
const AvatarImage = React.forwardRef<
6870
React.ElementRef<typeof AvatarPrimitive.Image>,
6971
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+
});
7784
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
7885

7986
const AvatarFallback = React.forwardRef<

site/src/pages/CreateWorkspacePage/SelectedTemplate.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,8 @@ export interface SelectedTemplateProps {
1515

1616
export const SelectedTemplate: FC<SelectedTemplateProps> = ({ template }) => {
1717
return (
18-
<Stack
19-
direction="row"
20-
spacing={3}
21-
css={styles.template}
22-
alignItems="center"
23-
>
24-
<Avatar variant="icon">
18+
<Stack direction="row" spacing={2} css={styles.template}>
19+
<Avatar variant="icon" size="lg">
2520
<AvatarImage src={template.icon} />
2621
<AvatarFallback>{avatarLetter(template.name)}</AvatarFallback>
2722
</Avatar>

0 commit comments

Comments
 (0)