From cf77c6908b16e3f936e61b9b2fae6a49535e8aa9 Mon Sep 17 00:00:00 2001 From: p-sw Date: Sun, 4 Aug 2024 14:40:49 +0900 Subject: [PATCH] feat: add number propMeta on Playground --- src/components/Playground.tsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/components/Playground.tsx b/src/components/Playground.tsx index a0cd069..c2d4bc2 100644 --- a/src/components/Playground.tsx +++ b/src/components/Playground.tsx @@ -44,6 +44,13 @@ export type ControlTemplate = Record< onChange: (value: string) => 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(props: { ))} + ) : propMeta.type === "number" ? ( + + propMeta.onChange(e.currentTarget.valueAsNumber) + } + /> ) : null} ))}