import { bookStickerSlotColor, type BookElement, type BookStickerElement } from '@trek/shared'; import { bookSticker } from '@trek/shared/stickers'; import type { ReactNode } from 'react'; import { Line, Section } from './StudioControls'; import { Swatches } from './StudioSwatches'; import { stickerLabel, withSlotColor } from './stickerLibrary'; /** * The inspector of a sticker: its colours slot by slot first, then where it * sits, which for a sticker is open from the start and holds its mirror and * its turn (StudioPositionSection.tsx). * * Every slot is offered with the colour it shows now, the sticker's own until * somebody picks another, and choosing one writes the colours of the slots * before it as well, so the list the document keeps always reads in slot order. */ type Translate = (k: string, params?: Record) => string; export function StudioStickerInspector({ el, set, position, t, }: { el: BookStickerElement; set: (patch: Partial) => void; position: ReactNode; t: Translate; }) { const def = bookSticker(el.stickerId); return ( <>
{def?.slots.map((slot, i) => ( set({ colors: withSlotColor(el, def.slots, i, color) })} /> ))} {el.colors.length > 0 && (
)}
{position} ); }