From 504f7f93cdc9704c1c97896f492c2599144a6f8a Mon Sep 17 00:00:00 2001 From: Iacopo Leardini Date: Thu, 18 Apr 2024 17:37:59 +0200 Subject: [PATCH 1/7] init Dropdown --- src/index.tsx | 1 + src/stories/Dropdown/Dropdown.stories.tsx | 16 ++++++++++++++++ src/stories/Dropdown/Option.tsx | 14 ++++++++++++++ src/stories/Dropdown/index.tsx | 16 ++++++++++++++++ src/stories/form/Form.stories.tsx | 2 +- src/stories/table/Table.tsx | 2 +- 6 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 src/stories/Dropdown/Dropdown.stories.tsx create mode 100644 src/stories/Dropdown/Option.tsx create mode 100644 src/stories/Dropdown/index.tsx diff --git a/src/index.tsx b/src/index.tsx index af88a88..88f3361 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -55,6 +55,7 @@ export * from "./stories/pill/Pill"; export * from "./stories/placesAutocomplete/PlacesAutocomplete"; export * from "./stories/progress-bar/ProgressBar"; export * from "./stories/select/Select"; +export * from "./stories/Dropdown"; export * from "./stories/sidebar/Sidebar"; export * from "./stories/skeleton/Skeleton"; export * from "./stories/spinner/Spinner"; diff --git a/src/stories/Dropdown/Dropdown.stories.tsx b/src/stories/Dropdown/Dropdown.stories.tsx new file mode 100644 index 0000000..6356c8d --- /dev/null +++ b/src/stories/Dropdown/Dropdown.stories.tsx @@ -0,0 +1,16 @@ +import { Meta, StoryFn } from "@storybook/react"; +import { SelectNew } from "."; + +export default { + title: "SelectNew", + component: SelectNew, +} as Meta; + +const Template: StoryFn = (args) => { + return ; +}; + +export const SelectBase = Template.bind({}); +SelectBase.args = { + value: { label: "", value: "" }, +}; diff --git a/src/stories/Dropdown/Option.tsx b/src/stories/Dropdown/Option.tsx new file mode 100644 index 0000000..baf3083 --- /dev/null +++ b/src/stories/Dropdown/Option.tsx @@ -0,0 +1,14 @@ +export interface DropdownOptions + extends React.HTMLAttributes { + value: string; + label: string; + [key: string]: any; +} + +export const Option = ({ value, label, ...props }: DropdownOptions) => { + return ( + + ); +}; diff --git a/src/stories/Dropdown/index.tsx b/src/stories/Dropdown/index.tsx new file mode 100644 index 0000000..0264f66 --- /dev/null +++ b/src/stories/Dropdown/index.tsx @@ -0,0 +1,16 @@ +import { DropdownOptions, Option } from "./Option"; + +export interface DropdownProps extends React.HTMLAttributes { + options: DropdownOptions[]; +} + +export const SelectNew = ({ options, ...props }: DropdownProps) => { + return ( + <> + + {options.map((option) => ( +