feat: add number propMeta on Playground

This commit is contained in:
p-sw 2024-08-04 14:40:49 +09:00
parent ca9036c1ad
commit cf77c6908b

View File

@ -44,6 +44,13 @@ export type ControlTemplate = Record<
onChange: (value: string) => void; onChange: (value: string) => void;
onToggle: (v: boolean) => void; onToggle: (v: boolean) => void;
} }
| {
type: "number";
value: number;
disabled?: boolean;
onChange: (value: number) => void;
onToggle: (v: boolean) => void;
}
> >
>; >;
@ -115,6 +122,14 @@ export function PlaygroundControl<T extends ControlTemplate>(props: {
))} ))}
</PopoverContent> </PopoverContent>
</Popover> </Popover>
) : propMeta.type === "number" ? (
<Input
type="number"
value={propMeta.value}
onChange={(e) =>
propMeta.onChange(e.currentTarget.valueAsNumber)
}
/>
) : null} ) : null}
</div> </div>
))} ))}