// Example C — composition (2nd priority): a feature-focused header in a different order // File → Line style → Text style → Dimension style → Print import { useState } from "react" import { SWHeaderActions, SWHeaderDimensionStyleMenu, SWHeaderDocumentTitle, SWHeaderLineStyleMenu, SWHeaderTextStyleMenu, SWTheme, type SWHeaderDimensionStyleValue, type SWHeaderLineStyleValue, type SWHeaderTextStyleValue, } from "@hm-design/sw" import { dimensionStyles, lineTypes, lineWeights, textStyles } from "./sample-data" import "./example-layout.css" export function ExampleCFeatureHeader({ onEvent }: { onEvent?: (name: string) => void }) { const [lineStyle, setLineStyle] = useState({ name: "ByLayer", weight: "ByLayer", scale: "1.00" }) const [textStyle, setTextStyle] = useState({ font: "Arial", name: "Standard" }) const [dimensionStyle, setDimensionStyle] = useState({ name: "Standard" }) return ( {/* No logo before the file well, so the consumer layout gives it its own left edge. */}
onEvent?.("document")} />
{ setLineStyle(current => ({ ...current, name: type.name })); onEvent?.(`lineType:${type.id}`) }} onLineWeightSelect={weight => { setLineStyle(current => ({ ...current, weight: weight.name })); onEvent?.(`lineWeight:${weight.id}`) }} onScaleChange={scale => { setLineStyle(current => ({ ...current, scale })); onEvent?.(`lineScale:${scale}`) }} /> { setTextStyle({ font: style.font, name: style.name }); onEvent?.(`textStyle:${style.id}`) }} /> { setDimensionStyle({ name: style.name }); onEvent?.(`dimensionStyle:${style.id}`) }} />
onEvent?.("print")} />
) }