// Example D — existing Layer / Color components next to a NEW consumer control (SWSearchControl). import { useState } from "react" import { SWHeaderColorMenu, SWHeaderLayerMenu, SWTheme, type SWHeaderColorValue } from "@hm-design/sw" import { colors, layers } from "./sample-data" import { SWSearchControl } from "./SWSearchControl" import "./example-layout.css" export function ExampleDSearchExtension({ onEvent }: { onEvent?: (name: string) => void }) { const [activeLayerId, setActiveLayerId] = useState("0") const [color, setColor] = useState({ value: "ByLayer", swatch: "#ffffff" }) const [query, setQuery] = useState("") return (
{ setActiveLayerId(layer.id); onEvent?.(`layer:${layer.id}`) }} /> { setColor({ value: option.label ?? option.color, swatch: option.color }); onEvent?.(`color:${option.id}`) }} /> onEvent?.(`search:${text}`)} />
) }