1 import { Photo } from "@medusajs/icons"
2 import { clx } from "@medusajs/ui"
3
4 type ThumbnailProps = {
5 src?: string | null
6 alt?: string
7 size?: "small" | "base"
8 }
9
10 export const Thumbnail = ({ src, alt, size = "base" }: ThumbnailProps) => {
11 return (
12 <div
13 className={clx(
14 "bg-ui-bg-component border-ui-border-base flex items-center justify-center overflow-hidden rounded border",
15 {
16 "h-8 w-6": size === "base",
17 "h-5 w-4": size === "small",
18 }
19 )}
20 >
21 {src ? (
22 <img
23 src={src}
24 alt={alt}
25 className="h-full w-full object-cover object-center"
26 />
27 ) : (
28 <Photo className="text-ui-fg-subtle" />
29 )}
30 </div>
31 )
32 }