From 25f21fcc93b5213f1e0fef3dabf24c1a21e6b41a Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Tue, 16 Nov 2021 21:46:07 -0500 Subject: [PATCH] input list --- .../components/Inputs/InputList.stories.tsx | 29 +++++++++++++++++++ web/src/components/Inputs/InputList.tsx | 17 +++++++---- 2 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 web/src/components/Inputs/InputList.stories.tsx diff --git a/web/src/components/Inputs/InputList.stories.tsx b/web/src/components/Inputs/InputList.stories.tsx new file mode 100644 index 0000000..2c74f16 --- /dev/null +++ b/web/src/components/Inputs/InputList.stories.tsx @@ -0,0 +1,29 @@ +import { ComponentMeta, ComponentStory } from "@storybook/react"; +import { useState } from "react"; +import { usePageTheme } from "~/styles/page"; +import InputList from "./InputList"; + +export default { + title: 'Inputs/InputList', + component: InputList, + parameters: { actions: { argTypesRegex: '^on.*' } }, + } as ComponentMeta; + + +const Template: ComponentStory = args => { + const {classes} = usePageTheme({}); + const [value, setValue] = useState('') + return
+ +
+} + +export const SimpleText = Template.bind({}) +SimpleText.args = { + label: "Entity ID", + options: [ + 'Bob', + 'Martin', + "Toots" + ] +} \ No newline at end of file diff --git a/web/src/components/Inputs/InputList.tsx b/web/src/components/Inputs/InputList.tsx index 8c4cd1e..f0e9f33 100644 --- a/web/src/components/Inputs/InputList.tsx +++ b/web/src/components/Inputs/InputList.tsx @@ -1,4 +1,6 @@ +import { useState } from "react"; import InputWrapper from "./InputWrapper"; +import { useInputTextStyles } from "./styles"; export interface Props { @@ -13,11 +15,16 @@ export default function InputList({ current, options, onChange, label, ...selattr }: Props) { - return - { + e.preventDefault(); + onChange(e.currentTarget.value); + }} + > {options.map((t, i) => )}