diff --git a/plugins/fake-profile-themes-and-effects/src/ui/components/Icon.ts b/plugins/fake-profile-themes-and-effects/src/ui/components/Icon.ts index 39bc13e..2c2828d 100644 --- a/plugins/fake-profile-themes-and-effects/src/ui/components/Icon.ts +++ b/plugins/fake-profile-themes-and-effects/src/ui/components/Icon.ts @@ -10,6 +10,18 @@ export interface IconProps extends Pick null` fallback, which has no .Sizes property at all for callers +// like `Icon.Sizes.LARGE` to read. Falling back to a real, static SizeKey map instead of an +// empty function means Icon always has a valid .Sizes even before the real module resolves. +const FALLBACK_SIZES: Record = { + EXTRA_SMALL_10: "extra_small_10", EXTRA_SMALL: "extra_small", SMALL: "small", SMALL_20: "small_20", + MEDIUM: "medium", LARGE: "large", CUSTOM: "custom", REFRESH_SMALL_16: "refresh_small_16", SMALL_14: "small_14", +}; + +const resolvedIcon = (findByProps("IconSizes") as Record | undefined)?.default; + export const Icon: ComponentType & { Sizes: Record; -} = (findByProps("IconSizes") as Record | undefined)?.default ?? (() => null); +} = resolvedIcon ?? Object.assign(() => null, { Sizes: FALLBACK_SIZES });