// sheet/borderIcons.tsx — the icons of the Borders gallery (S67-T15, instruction 16, J16). // // ⭐ ONE COMPONENT PER ENTRY, IN EXCEL'S OWN READING OF IT. Every preset icon is the same 16 by 16 // cell of four quarters: the edges the preset WRITES are drawn solid (thick or double where the // preset's name says so), and every other line of the cell is a faint dotted grid, so the eye // reads which sides change at a glance, exactly as Excel's menu does. // // ⚠ DESIGN CONTRACT (DESIGN.md 2 and 4): inline SVG on `currentColor`, the house `sheet-ribbon-icon` // class, no icon pack, no emoji, no ``, and no colour literal. The one colour an icon here // may paint is the person's chosen LINE colour, which is data (DESIGN.md 3) and arrives as a prop. import type { ReactNode } from "react"; import type { CellBorderStyle } from "./types"; /** The cell the icons draw on: an 11 by 11 box split into four quarters. */ const LO = 2.5; const MID = 8; const HI = 13.5; type Edge = "top" | "bottom" | "left" | "right" | "insideH" | "insideV"; const EDGE_PATH: Record = { top: `M${LO} ${LO}H${HI}`, bottom: `M${LO} ${HI}H${HI}`, left: `M${LO} ${LO}V${HI}`, right: `M${HI} ${LO}V${HI}`, insideH: `M${LO} ${MID}H${HI}`, insideV: `M${MID} ${LO}V${HI}`, }; /** Every line of the cell, faint and dotted: what a preset leaves alone. */ const GRID = Object.values(EDGE_PATH).join(""); function Cell({ children, faint = true }: { children?: ReactNode; faint?: boolean }) { return ( ); } /** Solid edges at the house weight. */ const solid = (...edges: Edge[]) => EDGE_PATH[e]).join("")} />; /** A thick edge, drawn at nearly twice the house weight. */ const thick = (...edges: Edge[]) => ( EDGE_PATH[e]).join("")} strokeWidth="2.6" strokeLinecap="square" /> ); /** The bottom edge as two thin rules, which is what Excel's double line is. */ const doubleBottom = () => ( ); export const IconBorderBottom = () => {solid("bottom")}; export const IconBorderTop = () => {solid("top")}; export const IconBorderLeft = () => {solid("left")}; export const IconBorderRight = () => {solid("right")}; export const IconBorderNone = () => ; export const IconBorderAll = () => ( {solid("top", "bottom", "left", "right", "insideH", "insideV")} ); export const IconBorderOutside = () => {solid("top", "bottom", "left", "right")}; export const IconBorderThickOutside = () => ( {thick("top", "bottom", "left", "right")} ); export const IconBorderBottomDouble = () => {doubleBottom()}; export const IconBorderThickBottom = () => {thick("bottom")}; export const IconBorderTopBottom = () => {solid("top", "bottom")}; export const IconBorderTopThickBottom = () => {solid("top")}{thick("bottom")}; export const IconBorderTopDoubleBottom = () => {solid("top")}{doubleBottom()}; /** A pencil laid across the cell's corner: the shared mark of the three draw tools. */ const PENCIL = "M9.2 10.8l4.6-4.6 1.4 1.4-4.6 4.6-2 .6.6-2Z"; export const IconDrawBorder = () => ( ); export const IconDrawBorderGrid = () => ( ); export const IconEraseBorder = () => ( ); /** A pencil over a bar in the chosen line colour, which is data and so arrives as a prop. */ export function IconLineColor({ colour }: { colour: string }) { return ( ); } /** Three rules of three weights and patterns: the choice the flyout offers. */ export const IconLineStyle = () => ( ); /** The whole grid drawn, with a small ellipsis mark: the dialog that holds every option. */ export const IconMoreBorders = () => ( ); /** * ⭐ ONE SAMPLE PER LINE STYLE, DRAWN AS THE PAINTER DRAWS IT (`cellBorders.ts::paintCellBorders`): * thin 1px, medium 2px, thick 3px, dashed, dotted, double, hair. The Line Style flyout shows the * line itself rather than a word, because the word is what a person has to translate. */ export function LineStyleSample({ style }: { style: CellBorderStyle }) { const common = { fill: "none", stroke: "currentColor", strokeLinecap: "butt" as const }; let body: ReactNode; switch (style) { case "medium": body = ; break; case "thick": body = ; break; case "dashed": body = ; break; case "dotted": body = ; break; case "double": body = ; break; case "hair": body = ; break; default: body = ; } return ( ); }