From ecca904cf2370de5969cd9b59014bd41a3cfd42f Mon Sep 17 00:00:00 2001 From: olestang Date: Mon, 28 Sep 2026 15:54:05 +0200 Subject: [PATCH 1/4] feat: add shared icon library --- apps/web/src/icons/IconBase.tsx | 45 ++++++++ apps/web/src/icons/actions.tsx | 186 ++++++++++++++++++++++++++++++ apps/web/src/icons/navigation.tsx | 110 ++++++++++++++++++ apps/web/src/icons/rating.tsx | 43 +++++++ apps/web/src/icons/recipe.tsx | 118 +++++++++++++++++++ apps/web/src/icons/status.tsx | 50 ++++++++ apps/web/src/icons/types.ts | 22 ++++ 7 files changed, 574 insertions(+) create mode 100644 apps/web/src/icons/IconBase.tsx create mode 100644 apps/web/src/icons/actions.tsx create mode 100644 apps/web/src/icons/navigation.tsx create mode 100644 apps/web/src/icons/rating.tsx create mode 100644 apps/web/src/icons/recipe.tsx create mode 100644 apps/web/src/icons/status.tsx create mode 100644 apps/web/src/icons/types.ts diff --git a/apps/web/src/icons/IconBase.tsx b/apps/web/src/icons/IconBase.tsx new file mode 100644 index 0000000..ff29bb2 --- /dev/null +++ b/apps/web/src/icons/IconBase.tsx @@ -0,0 +1,45 @@ +import type { ReactNode } from 'react'; +import type { IconProps } from './types'; + +export interface IconBaseProps extends IconProps { + children: ReactNode; + viewBox?: string; +} + +/** Internal base used by the raw SVG icon components. */ +export function IconBase({ + size = 'var(--icon-size-md)', + color, + title, + strokeWidth = 'var(--icon-stroke-default)', + children, + viewBox = '0 0 24 24', + style, + ...rest +}: IconBaseProps) { + const isLabelled = Boolean( + title || rest['aria-label'] || rest['aria-labelledby'], + ); + + return ( + + {title ? {title} : null} + {children} + + ); +} diff --git a/apps/web/src/icons/actions.tsx b/apps/web/src/icons/actions.tsx new file mode 100644 index 0000000..116fc13 --- /dev/null +++ b/apps/web/src/icons/actions.tsx @@ -0,0 +1,186 @@ +import { IconBase } from './IconBase'; +import type { IconProps } from './types'; + +export interface ToggleFillIconProps extends IconProps { + filled?: boolean; +} + +export function BookmarkIcon({ + filled = false, + ...props +}: ToggleFillIconProps) { + return ( + + + + ); +} + +export function AddRecipeIcon(props: IconProps) { + return ( + + + + + ); +} + +export function HeartIcon({ filled = false, ...props }: ToggleFillIconProps) { + return ( + + + + ); +} + +export function FilterIcon(props: IconProps) { + return ( + + + + ); +} + +export function SortIcon(props: IconProps) { + return ( + + + + + + + ); +} + +export function SettingsIcon(props: IconProps) { + return ( + + + + + ); +} + +export function UploadPhotoIcon(props: IconProps) { + return ( + + + + + + ); +} + +export function DeleteIcon(props: IconProps) { + return ( + + + + + + + ); +} + +export function EditIcon(props: IconProps) { + return ( + + + + + ); +} + +export function ShareIcon(props: IconProps) { + return ( + + + + + + + ); +} + +export function PrintIcon(props: IconProps) { + return ( + + + + + + + ); +} + +export function CheckIcon(props: IconProps) { + return ( + + + + ); +} + +export function CloseIcon(props: IconProps) { + return ( + + + + ); +} + +export function SaveDraftIcon(props: IconProps) { + return ( + + + + + + ); +} + +export function DragHandleIcon(props: IconProps) { + return ( + + {[8, 12, 16].flatMap((y) => + [9, 15].map((x) => ( + + )), + )} + + ); +} + +export function CameraIcon(props: IconProps) { + return ( + + + + + ); +} + +export function ImageIcon(props: IconProps) { + return ( + + + + + + ); +} diff --git a/apps/web/src/icons/navigation.tsx b/apps/web/src/icons/navigation.tsx new file mode 100644 index 0000000..6098ed6 --- /dev/null +++ b/apps/web/src/icons/navigation.tsx @@ -0,0 +1,110 @@ +import { IconBase } from './IconBase'; +import type { IconProps } from './types'; + +export function HomeIcon(props: IconProps) { + return ( + + + + + + ); +} + +export function CookbookIcon(props: IconProps) { + return ( + + + + + ); +} + +export function ProfileIcon(props: IconProps) { + return ( + + + + + ); +} + +export function SearchIcon(props: IconProps) { + return ( + + + + + ); +} + +export function ChevronDownIcon(props: IconProps) { + return ( + + + + ); +} + +export function ChevronLeftIcon(props: IconProps) { + return ( + + + + ); +} + +export function ChevronRightIcon(props: IconProps) { + return ( + + + + ); +} + +export function BackIcon(props: IconProps) { + return ( + + + + + ); +} + +export function LoginIcon(props: IconProps) { + return ( + + + + + + ); +} + +export function LogoutIcon(props: IconProps) { + return ( + + + + + + ); +} + +export function MenuIcon(props: IconProps) { + return ( + + + + ); +} + +export function MoreIcon(props: IconProps) { + return ( + + + + + + ); +} diff --git a/apps/web/src/icons/rating.tsx b/apps/web/src/icons/rating.tsx new file mode 100644 index 0000000..4ab3064 --- /dev/null +++ b/apps/web/src/icons/rating.tsx @@ -0,0 +1,43 @@ +import { useId } from 'react'; +import { IconBase } from './IconBase'; +import type { IconProps } from './types'; + +export type StarVariant = 'empty' | 'half' | 'full'; + +export interface StarIconProps extends IconProps { + variant?: StarVariant; +} + +const STAR_PATH = + 'M12 3.3 14.7 8.8l6.1.9-4.4 4.3 1 6.1-5.4-2.9-5.4 2.9 1-6.1-4.4-4.3 6.1-.9Z'; + +export function StarIcon({ variant = 'empty', ...props }: StarIconProps) { + const clipId = useId().replace(/:/g, ''); + + return ( + + {variant === 'half' ? ( + <> + + + + + + + + + ) : ( + + )} + + ); +} diff --git a/apps/web/src/icons/recipe.tsx b/apps/web/src/icons/recipe.tsx new file mode 100644 index 0000000..d49e098 --- /dev/null +++ b/apps/web/src/icons/recipe.tsx @@ -0,0 +1,118 @@ +import { IconBase } from './IconBase'; +import type { IconProps } from './types'; + +export function CookingTimeIcon(props: IconProps) { + return ( + + + + + ); +} + +export function ServingsIcon(props: IconProps) { + return ( + + + + + + + ); +} + +export function CategoriesIcon(props: IconProps) { + return ( + + + + + + + ); +} + +export function PublicIcon(props: IconProps) { + return ( + + + + + ); +} + +export function PrivateIcon(props: IconProps) { + return ( + + + + + ); +} + +export function EmptyStateIcon(props: IconProps) { + return ( + + + + + + + ); +} + +export function DietaryIcon(props: IconProps) { + return ( + + + + + ); +} + +export function ChefIcon(props: IconProps) { + return ( + + + + + + ); +} + +export function SoupIcon(props: IconProps) { + return ( + + + + + + ); +} + +export function InstructionsIcon(props: IconProps) { + return ( + + + + + ); +} + +export function RecentRecipesIcon(props: IconProps) { + return ( + + + + + + ); +} + +export function DifficultyIcon(props: IconProps) { + return ( + + + + ); +} diff --git a/apps/web/src/icons/status.tsx b/apps/web/src/icons/status.tsx new file mode 100644 index 0000000..5f603b1 --- /dev/null +++ b/apps/web/src/icons/status.tsx @@ -0,0 +1,50 @@ +import { IconBase } from './IconBase'; +import type { IconProps } from './types'; + +export function InfoIcon(props: IconProps) { + return ( + + + + + + ); +} + +export function SuccessIcon(props: IconProps) { + return ( + + + + + ); +} + +export function ErrorIcon(props: IconProps) { + return ( + + + + + ); +} + +export function AlertIcon(props: IconProps) { + return ( + + + + + + ); +} + +export function AlertTriangleIcon(props: IconProps) { + return ( + + + + + + ); +} diff --git a/apps/web/src/icons/types.ts b/apps/web/src/icons/types.ts new file mode 100644 index 0000000..4e9c553 --- /dev/null +++ b/apps/web/src/icons/types.ts @@ -0,0 +1,22 @@ +import type { SVGProps } from 'react'; + +/** A raw icon can use any CSS length or a numeric SVG size. */ +export type IconSize = number | string; + +/** + * Shared props for every raw recipe icon. + * + * Raw icons are intentionally presentation-light: they draw the SVG shape, + * use currentColor, and accept normal SVG props. For design-system sizing and + * semantic colors, prefer components/ui/Icon. + */ +export interface IconProps extends Omit, 'color'> { + /** CSS size, rem value, px number, or token such as var(--icon-size-md). */ + size?: IconSize; + /** Explicit CSS color. Omit it to inherit currentColor. */ + color?: string; + /** Accessible title. Decorative icons are aria-hidden by default. */ + title?: string; + /** Stroke width for outline icons. */ + strokeWidth?: number | string; +} From e8341bce86946c0a2124e253e445e95f0a100418 Mon Sep 17 00:00:00 2001 From: olestang Date: Mon, 28 Sep 2026 15:54:23 +0200 Subject: [PATCH 2/4] feat: add reusable Icon component --- apps/web/src/components/ui/Icon/Icon.css | 74 +++++++++++ apps/web/src/components/ui/Icon/Icon.tsx | 151 +++++++++++++++++++++++ 2 files changed, 225 insertions(+) create mode 100644 apps/web/src/components/ui/Icon/Icon.css create mode 100644 apps/web/src/components/ui/Icon/Icon.tsx diff --git a/apps/web/src/components/ui/Icon/Icon.css b/apps/web/src/components/ui/Icon/Icon.css new file mode 100644 index 0000000..f46e06d --- /dev/null +++ b/apps/web/src/components/ui/Icon/Icon.css @@ -0,0 +1,74 @@ +@layer components { + .ui-icon { + color: inherit; + stroke-width: var(--icon-stroke-default); + + display: inline-block; + flex: none; + vertical-align: middle; + + /* + * Icon itself is presentation-only. Interactive parents such as + * Button, IconButton, links, and cards own hover/active states. + */ + transition: + color var(--duration-fast) var(--ease-standard), + stroke-width var(--duration-fast) var(--ease-standard); + } + + /* Color tones */ + + .ui-icon--inherit { + color: inherit; + } + + .ui-icon--default { + color: var(--color-icon-primary); + } + + .ui-icon--secondary { + color: var(--color-icon-secondary); + } + + .ui-icon--muted { + color: var(--color-icon-muted); + } + + .ui-icon--brand { + color: var(--color-brand-primary); + } + + .ui-icon--success { + color: var(--color-feedback-success); + } + + .ui-icon--warning { + color: var(--color-feedback-warning); + } + + .ui-icon--error { + color: var(--color-feedback-error); + } + + .ui-icon--info { + color: var(--color-feedback-info); + } + + .ui-icon--inverse { + color: var(--color-text-inverse); + } + + /* Stroke weights */ + + .ui-icon--stroke-thin { + stroke-width: var(--icon-stroke-thin); + } + + .ui-icon--stroke-default { + stroke-width: var(--icon-stroke-default); + } + + .ui-icon--stroke-strong { + stroke-width: var(--icon-stroke-strong); + } +} diff --git a/apps/web/src/components/ui/Icon/Icon.tsx b/apps/web/src/components/ui/Icon/Icon.tsx new file mode 100644 index 0000000..a59e73e --- /dev/null +++ b/apps/web/src/components/ui/Icon/Icon.tsx @@ -0,0 +1,151 @@ +import type { ComponentType, CSSProperties } from 'react'; + +import type { IconProps as SvgIconProps } from '../../../icons/types'; + +import './Icon.css'; + +export type IconTone = + | 'inherit' + | 'default' + | 'secondary' + | 'muted' + | 'brand' + | 'success' + | 'warning' + | 'error' + | 'info' + | 'inverse'; + +export type IconStroke = 'thin' | 'default' | 'strong'; + +export type UiIconSize = 'sm' | 'md' | 'lg' | 'xl' | SvgIconProps['size']; + +type IconSpecificProps

= Omit; + +export interface IconProps

+ extends Omit { + /** + * Raw SVG icon component to render. + */ + icon: ComponentType

; + + /** + * Design-system size or an explicit CSS/SVG size. + */ + size?: UiIconSize; + + /** + * Semantic icon color. + * + * "inherit" is the default so interactive parents such as + * Button, IconButton, and links can control hover/active color. + */ + tone?: IconTone; + + /** + * Explicit CSS color override. + * + * Prefer tone for normal design-system usage. + */ + color?: string; + + /** + * Design-system stroke weight. + */ + stroke?: IconStroke; + + /** + * Escape hatch for an explicit numeric SVG stroke width. + * + * Prefer stroke="thin" | "default" | "strong" normally. + */ + strokeWidth?: number; + + /** + * Props specific to the chosen raw icon. + * + * Examples: + * { filled: true } + * { variant: "half" } + */ + iconProps?: IconSpecificProps

; +} + +const SIZE_TOKENS: Record<'sm' | 'md' | 'lg' | 'xl', string> = { + sm: 'var(--icon-size-sm)', + md: 'var(--icon-size-md)', + lg: 'var(--icon-size-lg)', + xl: 'var(--icon-size-xl)', +}; + +function resolveSize(size: UiIconSize | undefined): SvgIconProps['size'] { + if (size === undefined) { + return SIZE_TOKENS.md; + } + + if (typeof size === 'string' && size in SIZE_TOKENS) { + return SIZE_TOKENS[size as keyof typeof SIZE_TOKENS]; + } + + return size; +} + +/** + * Design-system wrapper around the raw SVG icons. + * + * Icon intentionally does not define hover/active states itself. + * It inherits color by default so the interactive parent owns + * those states. + * + * Examples: + * + * + * + * + * + * + */ +export function Icon

({ + icon: Component, + iconProps, + size = 'md', + tone = 'inherit', + color, + stroke = 'default', + strokeWidth, + className, + style, + ...svgProps +}: IconProps

) { + const classes = [ + 'ui-icon', + `ui-icon--${tone}`, + `ui-icon--stroke-${stroke}`, + className, + ] + .filter(Boolean) + .join(' '); + + const iconStyle: CSSProperties = { + ...style, + ...(strokeWidth !== undefined ? { strokeWidth } : {}), + }; + + return ( + )} + size={resolveSize(size)} + color={color} + className={classes} + style={iconStyle} + /> + ); +} From a05141b78598b56c96a2ee9ff09104ad4e7214b6 Mon Sep 17 00:00:00 2001 From: olestang Date: Mon, 28 Sep 2026 15:55:11 +0200 Subject: [PATCH 3/4] test: add icon showcase for visual verification --- .../components/ui/showcase/IconShowcase.tsx | 951 ++++++++++++++++++ .../ui/showcase/UiShowcaseCatalog.tsx | 11 + .../components/ui/showcase/showcaseStyles.ts | 16 + 3 files changed, 978 insertions(+) create mode 100644 apps/web/src/components/ui/showcase/IconShowcase.tsx create mode 100644 apps/web/src/components/ui/showcase/UiShowcaseCatalog.tsx create mode 100644 apps/web/src/components/ui/showcase/showcaseStyles.ts diff --git a/apps/web/src/components/ui/showcase/IconShowcase.tsx b/apps/web/src/components/ui/showcase/IconShowcase.tsx new file mode 100644 index 0000000..da0977b --- /dev/null +++ b/apps/web/src/components/ui/showcase/IconShowcase.tsx @@ -0,0 +1,951 @@ +import type { + ComponentType, + CSSProperties, +} from "react"; + +import { + Icon, + type IconTone, +} from "../Icon/Icon"; + +import { + AddRecipeIcon, + BookmarkIcon, + CameraIcon, + CheckIcon, + CloseIcon, + DeleteIcon, + DragHandleIcon, + EditIcon, + FilterIcon, + HeartIcon, + ImageIcon, + PrintIcon, + SaveDraftIcon, + SettingsIcon, + ShareIcon, + SortIcon, + UploadPhotoIcon, +} from "../../../icons/actions"; +import { + BackIcon, + ChevronDownIcon, + ChevronLeftIcon, + ChevronRightIcon, + CookbookIcon, + HomeIcon, + LoginIcon, + MenuIcon, + MoreIcon, + ProfileIcon, + SearchIcon, +} from "../../../icons/navigation"; +import { StarIcon } from "../../../icons/rating"; +import { + CategoriesIcon, + ChefIcon, + CookingTimeIcon, + DietaryIcon, + DifficultyIcon, + EmptyStateIcon, + InstructionsIcon, + PrivateIcon, + PublicIcon, + RecentRecipesIcon, + ServingsIcon, + SoupIcon, +} from "../../../icons/recipe"; +import { + AlertIcon, + AlertTriangleIcon, + ErrorIcon, + InfoIcon, + SuccessIcon, +} from "../../../icons/status"; +import type { + IconProps as RawIconProps, +} from "../../../icons/types"; +import { surfaceStyle, raisedSurfaceStyle } from "./showcaseStyles"; + +type IconEntry = { + name: string; + Component: ComponentType; +}; + + + +const iconGridStyle: CSSProperties = { + display: "grid", + + gridTemplateColumns: + "repeat(auto-fill, minmax(8rem, 1fr))", + + columnGap: "var(--space-5)", + rowGap: "var(--space-8)", + + alignItems: "start", + + paddingBlock: + "var(--space-4)", +}; + +const iconGridItemStyle: CSSProperties = { + display: "flex", + flexDirection: "column", + + alignItems: "center", + + gap: "var(--space-3)", + + minWidth: 0, + + textAlign: "center", +}; + +const iconNameStyle: CSSProperties = { + color: + "var(--color-text-secondary)", + + fontFamily: + 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace', + + fontSize: + "var(--font-size-xs)", + + lineHeight: + "var(--line-height-snug)", + + overflowWrap: "anywhere", +}; + +const allIcons: IconEntry[] = [ + { + name: "HomeIcon", + Component: HomeIcon, + }, + { + name: "CookbookIcon", + Component: CookbookIcon, + }, + { + name: "BookmarkIcon", + Component: BookmarkIcon, + }, + { + name: "AddRecipeIcon", + Component: AddRecipeIcon, + }, + { + name: "ProfileIcon", + Component: ProfileIcon, + }, + { + name: "SearchIcon", + Component: SearchIcon, + }, + { + name: "HeartIcon", + Component: HeartIcon, + }, + { + name: "StarIcon", + Component: StarIcon, + }, + + { + name: "CookingTimeIcon", + Component: CookingTimeIcon, + }, + { + name: "ServingsIcon", + Component: ServingsIcon, + }, + { + name: "CategoriesIcon", + Component: CategoriesIcon, + }, + { + name: "FilterIcon", + Component: FilterIcon, + }, + { + name: "SortIcon", + Component: SortIcon, + }, + { + name: "SettingsIcon", + Component: SettingsIcon, + }, + { + name: "UploadPhotoIcon", + Component: UploadPhotoIcon, + }, + { name: "CameraIcon", Component: CameraIcon }, + { name: "ImageIcon", Component: ImageIcon }, + { + name: "DeleteIcon", + Component: DeleteIcon, + }, + + { + name: "EditIcon", + Component: EditIcon, + }, + { + name: "ShareIcon", + Component: ShareIcon, + }, + { + name: "PrintIcon", + Component: PrintIcon, + }, + { + name: "PublicIcon", + Component: PublicIcon, + }, + { + name: "PrivateIcon", + Component: PrivateIcon, + }, + { + name: "CheckIcon", + Component: CheckIcon, + }, + { + name: "ChevronDownIcon", + Component: ChevronDownIcon, + }, + { + name: "ChevronLeftIcon", + Component: ChevronLeftIcon, + }, + { + name: "ChevronRightIcon", + Component: ChevronRightIcon, + }, + { + name: "CloseIcon", + Component: CloseIcon, + }, + + { + name: "BackIcon", + Component: BackIcon, + }, + { + name: "InfoIcon", + Component: InfoIcon, + }, + { + name: "SuccessIcon", + Component: SuccessIcon, + }, + { + name: "ErrorIcon", + Component: ErrorIcon, + }, + { + name: "AlertIcon", + Component: AlertIcon, + }, + { + name: "EmptyStateIcon", + Component: EmptyStateIcon, + }, + { + name: "DietaryIcon", + Component: DietaryIcon, + }, + { name: "DifficultyIcon", Component: DifficultyIcon }, + { + name: "ChefIcon", + Component: ChefIcon, + }, + { + name: "SoupIcon", + Component: SoupIcon, + }, + + { + name: "LoginIcon", + Component: LoginIcon, + }, + { name: "MenuIcon", Component: MenuIcon }, + { name: "MoreIcon", Component: MoreIcon }, + { + name: "InstructionsIcon", + Component: InstructionsIcon, + }, + { + name: "SaveDraftIcon", + Component: SaveDraftIcon, + }, + { + name: "AlertTriangleIcon", + Component: AlertTriangleIcon, + }, + { + name: "RecentRecipesIcon", + Component: RecentRecipesIcon, + }, + { + name: "DragHandleIcon", + Component: DragHandleIcon, + }, +]; + +const toneExamples: Array<{ + tone: Exclude; + label: string; +}> = [ + { + tone: "default", + label: "Default", + }, + { + tone: "secondary", + label: "Secondary", + }, + { + tone: "muted", + label: "Muted", + }, + { + tone: "brand", + label: "Brand", + }, + { + tone: "success", + label: "Success", + }, + { + tone: "warning", + label: "Warning", + }, + { + tone: "error", + label: "Error", + }, + { + tone: "info", + label: "Info", + }, +]; + +export default function IconShowcase() { + return ( +

+
+
+

Icon Showcase

+ +

+ Visual reference for the shared Icon + component and the raw recipe icon + collection. +

+
+ + {/* All icons */} + +
+
+

All Icons

+ +

+ The name underneath each icon is its + exported React component name. +

+
+ +
+
+ {allIcons.map( + ({ + name, + Component, + }) => ( +
+ + + + {name} + +
+ ), + )} +
+
+
+ +
+ + {/* Sizes */} + +
+
+

Sizes

+ +

+ Named sizes map to the shared + icon-size design tokens. +

+
+ +
+
+ + sm +
+ +
+ + md +
+ +
+ + lg +
+ +
+ + xl +
+ +
+ + 2.75rem +
+
+
+ + {/* Inheritance */} + +
+
+

Color Inheritance

+ +

+ Icon uses{" "} + tone="inherit" by + default. This lets an interactive + parent own hover, active, focus, + selected, and disabled colors. +

+
+ +
+
+ + Inherited text color +
+ +
+ + Inherited brand color +
+ +
+ + Inherited error color +
+
+ + + { + '' + } + +
+ + {/* Tones */} + +
+
+

Semantic Tones

+ +

+ Use an explicit tone when the icon + has semantic meaning independent of + its parent. +

+
+ +
+ {toneExamples.map( + ({ tone, label }) => ( +
+ + + {label} +
+ ), + )} + +
+ + + + Inverse + +
+
+
+ + {/* Stroke */} + +
+
+

Stroke Weight

+ +

+ Named stroke weights use the icon + stroke tokens from{" "} + tokens.css. +

+
+ +
+
+ + thin +
+ +
+ + default +
+ +
+ + strong +
+
+ + + { + '' + } + +
+ + {/* Typical colors */} + +
+

Typical Semantic Usage

+ +
+
+ + Add recipe +
+ +
+ + Success +
+ +
+ + Warning +
+ +
+ + Destructive +
+ +
+ + Information +
+ +
+ + Dietary +
+
+
+ +
+ + {/* Stateful */} + +
+
+

Stateful Icons

+ +

+ Icon-specific state is passed + through iconProps. +

+
+ +
+
+

BookmarkIcon

+ +
+
+ + + Unfilled +
+ +
+ + + Filled +
+
+ + + { + '' + } + +
+ +
+

HeartIcon

+ +
+
+ + + Unfilled +
+ +
+ + + Filled +
+
+
+ +
+

StarIcon

+ +
+
+ + + Empty +
+ +
+ + + Half +
+ +
+ + + Full +
+
+
+
+
+ + {/* Explicit overrides */} + +
+
+

Explicit Overrides

+ +

+ Available for exceptional cases. + Semantic tones and named stroke + weights should normally be preferred. +

+
+ +
+
+ + + custom color +
+ +
+ + + strokeWidth=2.2 +
+
+
+ + {/* Recipe context */} + +
+

Recipe Context

+ +
+
+ + + 25 min +
+ +
+ + + 4 servings +
+ +
+ + + Vegetarian +
+ +
+ + + 4.8 rating +
+
+
+
+
+ ); +} \ No newline at end of file diff --git a/apps/web/src/components/ui/showcase/UiShowcaseCatalog.tsx b/apps/web/src/components/ui/showcase/UiShowcaseCatalog.tsx new file mode 100644 index 0000000..4ce6465 --- /dev/null +++ b/apps/web/src/components/ui/showcase/UiShowcaseCatalog.tsx @@ -0,0 +1,11 @@ +import IconShowcase from './IconShowcase'; + +// Intentionally render every showcase in one scrollable catalog. +// More showcases can be added back here as they are implemented. +export default function UiShowcaseCatalog() { + return ( +
+ +
+ ); +} \ No newline at end of file diff --git a/apps/web/src/components/ui/showcase/showcaseStyles.ts b/apps/web/src/components/ui/showcase/showcaseStyles.ts new file mode 100644 index 0000000..78e30fc --- /dev/null +++ b/apps/web/src/components/ui/showcase/showcaseStyles.ts @@ -0,0 +1,16 @@ +import type { CSSProperties } from 'react'; + +export const surfaceStyle: CSSProperties = { + padding: 'var(--space-6)', + backgroundColor: 'var(--color-surface)', + border: 'var(--border-width-thin) solid var(--color-border-default)', + borderRadius: 'var(--radius-lg)', +}; + +export const raisedSurfaceStyle: CSSProperties = { + padding: 'var(--space-6)', + backgroundColor: 'var(--color-surface-raised)', + border: 'var(--border-width-thin) solid var(--color-border-subtle)', + borderRadius: 'var(--radius-lg)', + boxShadow: 'var(--shadow-sm)', +}; From e2c8d77410f2e453bca8ce0537238e0c146b518e Mon Sep 17 00:00:00 2001 From: olestang Date: Mon, 28 Sep 2026 15:56:23 +0200 Subject: [PATCH 4/4] fix: apply Prettier formatting to icon files --- .../components/ui/showcase/IconShowcase.tsx | 431 ++++++------------ .../ui/showcase/UiShowcaseCatalog.tsx | 2 +- 2 files changed, 147 insertions(+), 286 deletions(-) diff --git a/apps/web/src/components/ui/showcase/IconShowcase.tsx b/apps/web/src/components/ui/showcase/IconShowcase.tsx index da0977b..29c3151 100644 --- a/apps/web/src/components/ui/showcase/IconShowcase.tsx +++ b/apps/web/src/components/ui/showcase/IconShowcase.tsx @@ -1,12 +1,6 @@ -import type { - ComponentType, - CSSProperties, -} from "react"; +import type { ComponentType, CSSProperties } from 'react'; -import { - Icon, - type IconTone, -} from "../Icon/Icon"; +import { Icon, type IconTone } from '../Icon/Icon'; import { AddRecipeIcon, @@ -26,7 +20,7 @@ import { ShareIcon, SortIcon, UploadPhotoIcon, -} from "../../../icons/actions"; +} from '../../../icons/actions'; import { BackIcon, ChevronDownIcon, @@ -39,8 +33,8 @@ import { MoreIcon, ProfileIcon, SearchIcon, -} from "../../../icons/navigation"; -import { StarIcon } from "../../../icons/rating"; +} from '../../../icons/navigation'; +import { StarIcon } from '../../../icons/rating'; import { CategoriesIcon, ChefIcon, @@ -54,281 +48,272 @@ import { RecentRecipesIcon, ServingsIcon, SoupIcon, -} from "../../../icons/recipe"; +} from '../../../icons/recipe'; import { AlertIcon, AlertTriangleIcon, ErrorIcon, InfoIcon, SuccessIcon, -} from "../../../icons/status"; -import type { - IconProps as RawIconProps, -} from "../../../icons/types"; -import { surfaceStyle, raisedSurfaceStyle } from "./showcaseStyles"; +} from '../../../icons/status'; +import type { IconProps as RawIconProps } from '../../../icons/types'; +import { surfaceStyle, raisedSurfaceStyle } from './showcaseStyles'; type IconEntry = { name: string; Component: ComponentType; }; - - const iconGridStyle: CSSProperties = { - display: "grid", + display: 'grid', - gridTemplateColumns: - "repeat(auto-fill, minmax(8rem, 1fr))", + gridTemplateColumns: 'repeat(auto-fill, minmax(8rem, 1fr))', - columnGap: "var(--space-5)", - rowGap: "var(--space-8)", + columnGap: 'var(--space-5)', + rowGap: 'var(--space-8)', - alignItems: "start", + alignItems: 'start', - paddingBlock: - "var(--space-4)", + paddingBlock: 'var(--space-4)', }; const iconGridItemStyle: CSSProperties = { - display: "flex", - flexDirection: "column", + display: 'flex', + flexDirection: 'column', - alignItems: "center", + alignItems: 'center', - gap: "var(--space-3)", + gap: 'var(--space-3)', minWidth: 0, - textAlign: "center", + textAlign: 'center', }; const iconNameStyle: CSSProperties = { - color: - "var(--color-text-secondary)", + color: 'var(--color-text-secondary)', fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace', - fontSize: - "var(--font-size-xs)", + fontSize: 'var(--font-size-xs)', - lineHeight: - "var(--line-height-snug)", + lineHeight: 'var(--line-height-snug)', - overflowWrap: "anywhere", + overflowWrap: 'anywhere', }; const allIcons: IconEntry[] = [ { - name: "HomeIcon", + name: 'HomeIcon', Component: HomeIcon, }, { - name: "CookbookIcon", + name: 'CookbookIcon', Component: CookbookIcon, }, { - name: "BookmarkIcon", + name: 'BookmarkIcon', Component: BookmarkIcon, }, { - name: "AddRecipeIcon", + name: 'AddRecipeIcon', Component: AddRecipeIcon, }, { - name: "ProfileIcon", + name: 'ProfileIcon', Component: ProfileIcon, }, { - name: "SearchIcon", + name: 'SearchIcon', Component: SearchIcon, }, { - name: "HeartIcon", + name: 'HeartIcon', Component: HeartIcon, }, { - name: "StarIcon", + name: 'StarIcon', Component: StarIcon, }, { - name: "CookingTimeIcon", + name: 'CookingTimeIcon', Component: CookingTimeIcon, }, { - name: "ServingsIcon", + name: 'ServingsIcon', Component: ServingsIcon, }, { - name: "CategoriesIcon", + name: 'CategoriesIcon', Component: CategoriesIcon, }, { - name: "FilterIcon", + name: 'FilterIcon', Component: FilterIcon, }, { - name: "SortIcon", + name: 'SortIcon', Component: SortIcon, }, { - name: "SettingsIcon", + name: 'SettingsIcon', Component: SettingsIcon, }, { - name: "UploadPhotoIcon", + name: 'UploadPhotoIcon', Component: UploadPhotoIcon, }, - { name: "CameraIcon", Component: CameraIcon }, - { name: "ImageIcon", Component: ImageIcon }, + { name: 'CameraIcon', Component: CameraIcon }, + { name: 'ImageIcon', Component: ImageIcon }, { - name: "DeleteIcon", + name: 'DeleteIcon', Component: DeleteIcon, }, { - name: "EditIcon", + name: 'EditIcon', Component: EditIcon, }, { - name: "ShareIcon", + name: 'ShareIcon', Component: ShareIcon, }, { - name: "PrintIcon", + name: 'PrintIcon', Component: PrintIcon, }, { - name: "PublicIcon", + name: 'PublicIcon', Component: PublicIcon, }, { - name: "PrivateIcon", + name: 'PrivateIcon', Component: PrivateIcon, }, { - name: "CheckIcon", + name: 'CheckIcon', Component: CheckIcon, }, { - name: "ChevronDownIcon", + name: 'ChevronDownIcon', Component: ChevronDownIcon, }, { - name: "ChevronLeftIcon", + name: 'ChevronLeftIcon', Component: ChevronLeftIcon, }, { - name: "ChevronRightIcon", + name: 'ChevronRightIcon', Component: ChevronRightIcon, }, { - name: "CloseIcon", + name: 'CloseIcon', Component: CloseIcon, }, { - name: "BackIcon", + name: 'BackIcon', Component: BackIcon, }, { - name: "InfoIcon", + name: 'InfoIcon', Component: InfoIcon, }, { - name: "SuccessIcon", + name: 'SuccessIcon', Component: SuccessIcon, }, { - name: "ErrorIcon", + name: 'ErrorIcon', Component: ErrorIcon, }, { - name: "AlertIcon", + name: 'AlertIcon', Component: AlertIcon, }, { - name: "EmptyStateIcon", + name: 'EmptyStateIcon', Component: EmptyStateIcon, }, { - name: "DietaryIcon", + name: 'DietaryIcon', Component: DietaryIcon, }, - { name: "DifficultyIcon", Component: DifficultyIcon }, + { name: 'DifficultyIcon', Component: DifficultyIcon }, { - name: "ChefIcon", + name: 'ChefIcon', Component: ChefIcon, }, { - name: "SoupIcon", + name: 'SoupIcon', Component: SoupIcon, }, { - name: "LoginIcon", + name: 'LoginIcon', Component: LoginIcon, }, - { name: "MenuIcon", Component: MenuIcon }, - { name: "MoreIcon", Component: MoreIcon }, + { name: 'MenuIcon', Component: MenuIcon }, + { name: 'MoreIcon', Component: MoreIcon }, { - name: "InstructionsIcon", + name: 'InstructionsIcon', Component: InstructionsIcon, }, { - name: "SaveDraftIcon", + name: 'SaveDraftIcon', Component: SaveDraftIcon, }, { - name: "AlertTriangleIcon", + name: 'AlertTriangleIcon', Component: AlertTriangleIcon, }, { - name: "RecentRecipesIcon", + name: 'RecentRecipesIcon', Component: RecentRecipesIcon, }, { - name: "DragHandleIcon", + name: 'DragHandleIcon', Component: DragHandleIcon, }, ]; const toneExamples: Array<{ - tone: Exclude; + tone: Exclude; label: string; }> = [ { - tone: "default", - label: "Default", + tone: 'default', + label: 'Default', }, { - tone: "secondary", - label: "Secondary", + tone: 'secondary', + label: 'Secondary', }, { - tone: "muted", - label: "Muted", + tone: 'muted', + label: 'Muted', }, { - tone: "brand", - label: "Brand", + tone: 'brand', + label: 'Brand', }, { - tone: "success", - label: "Success", + tone: 'success', + label: 'Success', }, { - tone: "warning", - label: "Warning", + tone: 'warning', + label: 'Warning', }, { - tone: "error", - label: "Error", + tone: 'error', + label: 'Error', }, { - tone: "info", - label: "Info", + tone: 'info', + label: 'Info', }, ]; @@ -340,9 +325,8 @@ export default function IconShowcase() {

Icon Showcase

- Visual reference for the shared Icon - component and the raw recipe icon - collection. + Visual reference for the shared Icon component and the raw recipe + icon collection.

@@ -353,40 +337,20 @@ export default function IconShowcase() {

All Icons

- The name underneath each icon is its - exported React component name. + The name underneath each icon is its exported React component + name.

- {allIcons.map( - ({ - name, - Component, - }) => ( -
- - - - {name} - -
- ), - )} + {allIcons.map(({ name, Component }) => ( +
+ + + {name} +
+ ))}
@@ -400,8 +364,7 @@ export default function IconShowcase() {

Sizes

- Named sizes map to the shared - icon-size design tokens. + Named sizes map to the shared icon-size design tokens.

@@ -410,47 +373,27 @@ export default function IconShowcase() { style={surfaceStyle} >
- + sm
- + md
- + lg
- + xl
- + 2.75rem
@@ -463,11 +406,9 @@ export default function IconShowcase() {

Color Inheritance

- Icon uses{" "} - tone="inherit" by - default. This lets an interactive - parent own hover, active, focus, - selected, and disabled colors. + Icon uses tone="inherit" by default. This lets an + interactive parent own hover, active, focus, selected, and + disabled colors.

@@ -478,42 +419,30 @@ export default function IconShowcase() {
- + Inherited text color
- + Inherited brand color
- + Inherited error color
@@ -532,9 +461,8 @@ export default function IconShowcase() {

Semantic Tones

- Use an explicit tone when the icon - has semantic meaning independent of - its parent. + Use an explicit tone when the icon has semantic meaning + independent of its parent.

@@ -542,46 +470,29 @@ export default function IconShowcase() { className="flex flex-wrap items-center gap-8" style={surfaceStyle} > - {toneExamples.map( - ({ tone, label }) => ( -
- + {toneExamples.map(({ tone, label }) => ( +
+ - {label} -
- ), - )} + {label} +
+ ))}
- + Inverse @@ -597,8 +508,7 @@ export default function IconShowcase() {

Stroke Weight

- Named stroke weights use the icon - stroke tokens from{" "} + Named stroke weights use the icon stroke tokens from{' '} tokens.css.

@@ -638,11 +548,7 @@ export default function IconShowcase() { - - { - '' - } - + {''} {/* Typical colors */} @@ -655,58 +561,32 @@ export default function IconShowcase() { style={raisedSurfaceStyle} >
- + Add recipe
- + Success
- + Warning
- + Destructive
- + Information
- + Dietary
@@ -721,15 +601,11 @@ export default function IconShowcase() {

Stateful Icons

- Icon-specific state is passed - through iconProps. + Icon-specific state is passed through iconProps.

-
+

BookmarkIcon

@@ -810,7 +686,7 @@ export default function IconShowcase() { size="xl" tone="warning" iconProps={{ - variant: "empty", + variant: 'empty', }} /> @@ -823,7 +699,7 @@ export default function IconShowcase() { size="xl" tone="warning" iconProps={{ - variant: "half", + variant: 'half', }} /> @@ -836,7 +712,7 @@ export default function IconShowcase() { size="xl" tone="warning" iconProps={{ - variant: "full", + variant: 'full', }} /> @@ -854,8 +730,7 @@ export default function IconShowcase() {

Explicit Overrides

- Available for exceptional cases. - Semantic tones and named stroke + Available for exceptional cases. Semantic tones and named stroke weights should normally be preferred.

@@ -896,37 +771,23 @@ export default function IconShowcase() { className="flex flex-col gap-5" style={{ ...raisedSurfaceStyle, - maxWidth: "34rem", + maxWidth: '34rem', }} >
- + 25 min
- + 4 servings
- + Vegetarian
@@ -937,7 +798,7 @@ export default function IconShowcase() { tone="warning" size="md" iconProps={{ - variant: "full", + variant: 'full', }} /> @@ -948,4 +809,4 @@ export default function IconShowcase() {
); -} \ No newline at end of file +} diff --git a/apps/web/src/components/ui/showcase/UiShowcaseCatalog.tsx b/apps/web/src/components/ui/showcase/UiShowcaseCatalog.tsx index 4ce6465..1950bd0 100644 --- a/apps/web/src/components/ui/showcase/UiShowcaseCatalog.tsx +++ b/apps/web/src/components/ui/showcase/UiShowcaseCatalog.tsx @@ -8,4 +8,4 @@ export default function UiShowcaseCatalog() {
); -} \ No newline at end of file +}