loopable / web /src /ui /IconTile.tsx
fsanyoto's picture
Deploy AIOS web (React glide grid + FastAPI slice)
86d34c4 verified
Raw History Blame Contribute Delete
1.08 kB
import type { ReactNode } from "react";
import type { FolderIcon } from "../customer-grid/types";
import { dbChipClass } from "../shell/nav";
import "../styles/sdlc80/icon-tile.css";
export type IconTileSurface = "home" | "home-card" | "starred" | "rail" | "template";
/** `chip` is the filled database chip, `tint` the light app chip, `none` paints no background. */
export type IconTileFill = "chip" | "tint" | "none";
/** Object tiles share their frame; each surface owns one size token and each call its fill. */
export function IconTile({ children, icon, surface = "home", fill = "none" }: {
children: ReactNode;
icon?: FolderIcon;
surface?: IconTileSurface;
fill?: IconTileFill;
}) {
// `tint` reuses the app chip class so the tile keeps that chip's background and ink.
const fillClass = fill === "chip" ? dbChipClass(icon) + " " : fill === "tint" ? "home-app-glyph " : "";
return <span className={fillClass + "lp-icon-tile lp-icon-tile--" + surface}
data-icon-tile={surface} aria-hidden="true">
{children}
</span>;
}
export default IconTile;