// Example F — a viewer header: logo → Open → file → layer → color → K, plus a tool bar (Model / Layout, 2.5D, // Fit) after the menus. Everything is SWHeader props, so the existing responsive More serves the whole layout // (Open moves into More when the measured header has no room). No freeze / lock, no "+ New" in this product. import { useState } from "react" import { SWHeader, SWToolButton, SWToolGroup } from "@hm-design/sw" import { colors, documents, layers } from "./sample-data" // The program supplies its icons (24 x 23 box of a pill button). Colors: the existing print icon fill #B6D0C9, // hover --hm-sw-header-selected-color (#FFC600), as in DESIGN_RULES §2. const FitIcon = ({ color }: { color: string }) => ( ) export function ExampleFViewerToolbar({ onEvent }: { onEvent?: (name: string) => void }) { const [activeLayerId, setActiveLayerId] = useState("0") const [view, setView] = useState<"model" | "layout">("model") const [depth, setDepth] = useState(false) return ( onEvent?.("document:open")} onDocumentSelect={document => onEvent?.(`document:${document.id}`)} controls={[{ id: "document" }, { id: "layer" }, { id: "color" }, { id: "popupGuide" }]} hiddenControls={["documentNew", "layerFreeze", "layerLock"]} layers={layers} activeLayerId={activeLayerId} onLayerSelect={layer => { setActiveLayerId(layer.id); onEvent?.(`layer:${layer.id}`) }} colors={colors} onColorSelect={option => onEvent?.(`color:${option.id}`)} tools={<> { setView("model"); onEvent?.("view:model") }}>Model { setView("layout"); onEvent?.("view:layout") }}>Layout { setDepth(!depth); onEvent?.(`2.5d:${!depth}`) }}>2.5D } hoverIcon={} onClick={() => onEvent?.("fit")}>화면 맞춤 } /> ) }