From 6ecdb9d66d4deb579077a4a227f4c6c9ceeec9d6 Mon Sep 17 00:00:00 2001 From: Anurag Date: Thu, 29 Oct 2020 19:44:20 +0530 Subject: [PATCH] chore: fixed broken storybook examples and improved them --- src/select/stories/Select.stories.tsx | 107 ++++++++++++++++++++------ src/select/stories/style.css | 15 ++-- 2 files changed, 91 insertions(+), 31 deletions(-) diff --git a/src/select/stories/Select.stories.tsx b/src/select/stories/Select.stories.tsx index 125301d1b..b67091f32 100644 --- a/src/select/stories/Select.stories.tsx +++ b/src/select/stories/Select.stories.tsx @@ -15,36 +15,49 @@ export default { } as Meta; const countries = [ - { name: "australia" }, - { name: "russia" }, - { name: "new zealand" }, - { name: "india" }, - { name: "california" }, - { name: "ireland" }, - { name: "indonesia" }, - { name: "chennai" }, - { name: "mexico" }, - { name: "sydney" }, - { name: "africa" }, - { name: "las vagas" }, - { name: "vietnam" }, - { name: "zimbabwe" }, + { name: "australia", emoji: "🇦🇺" }, + { name: "russia", emoji: "🇷🇺" }, + { name: "new zealand", emoji: "🇳🇿" }, + { name: "india", emoji: "🇮🇳" }, + { name: "niger", emoji: "🇳🇪" }, + { name: "canada", emoji: "🇨🇦" }, + { name: "indonesia", emoji: "🇮🇩" }, + { name: "portugal", emoji: "🇵🇹" }, + { name: "norway", emoji: "🇳🇴" }, + { name: "switzerland", emoji: "🇨🇭" }, + { name: "africa", emoji: "🇨🇫" }, + { name: "colombia", emoji: "🇨🇴" }, + { name: "costa rica", emoji: "🇨🇷" }, + { name: "zimbabwe", emoji: "🇿🇼" }, ]; const SelectPicker: React.FC<{ state: any }> = ({ state }) => { return ( - console.log(value)} + > + + {state.isPlaceholder ? "Select one.." : state.selected.join(",")} - + {countries.map(item => { return ( - - {item.name} + + {item.emoji} - {item.name} ); })} @@ -62,15 +75,50 @@ export const Default: React.FC = () => { export const MultiSelect: React.FC = () => { const state = useSelectState({ allowMultiselect: true }); - return ; + return ( + + ); }; export const MultiSelectCheckboxes: React.FC = () => { const state = useSelectState({ allowMultiselect: true }); return ( - console.log(value)} + > + {state.isPlaceholder ? "Select one.." @@ -78,10 +126,19 @@ export const MultiSelectCheckboxes: React.FC = () => { - + {countries.map(item => { return ( - +