1 import { clx } from "@medusajs/ui";
2 import { PropsWithChildren } from "react";
3
4 type IconAvatarProps = PropsWithChildren<{
5 className?: string;
6 size?: "small" | "large" | "xlarge";
7 }>;
8
9 /**
10 * Use this component when a design calls for an avatar with an icon.
11 *
12 * The `<Avatar/>` component from `@medusajs/ui` does not support passing an icon as a child.
13 */
14 export const IconAvatar = ({
15 size = "small",
16 children,
17 className,
18 }: IconAvatarProps) => {
19 return (
20 <div
21 className={clx(
22 "shadow-borders-base flex size-7 items-center justify-center",
23 "[&>div]:bg-ui-bg-field [&>div]:text-ui-fg-subtle [&>div]:flex [&>div]:size-6 [&>div]:items-center [&>div]:justify-center",
24 {
25 "size-7 rounded-md [&>div]:size-6 [&>div]:rounded-[4px]":
26 size === "small",
27 "size-10 rounded-lg [&>div]:size-9 [&>div]:rounded-[6px]":
28 size === "large",
29 "size-12 rounded-xl [&>div]:size-11 [&>div]:rounded-[10px]":
30 size === "xlarge",
31 },
32 className
33 )}
34 >
35 <div>{children}</div>
36 </div>
37 );
38 };