File size: 1,077 Bytes
8873406
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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;