import React from "react"; import { SvgSymbolContext, swapColors } from "./svg-symbol"; import { float } from "./util"; export const SymbolContextWidget: React.FC<{ ctx: SvgSymbolContext; onChange: (value: SvgSymbolContext) => void; children?: any; }> = ({ ctx, children, onChange }) => { const updateCtx = (updates: Partial) => { onChange({ ...ctx, ...updates }); }; return (

{children} updateCtx({ stroke: e.target.value })} id="stroke" />{" "} updateCtx({ fill: e.target.value })} id="fill" />{" "} {" "} {ctx.uniformStrokeWidth !== undefined && ( <>
updateCtx({ uniformStrokeWidth: float(e.target.value) }) } />{" "} {ctx.uniformStrokeWidth}{" "} )}

); };