Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade listbox #214

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions stories/FieldColorDesignation.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import React from 'react';
import { css } from '@emotion/react';
import { Meta } from '@storybook/react';
import { ThemeSplitView } from './components/ThemeSplitView';
import { withDesign } from 'storybook-addon-designs';
import {
Dropdown,
FieldColorDesignation,
Item,
ListBox,
Picker,
Provider,
TextArea,
TextField,
} from '../src';
import { withDesign } from 'storybook-addon-designs';
import { ThemeSplitView } from './components/ThemeSplitView';

const meta: Meta = {
title: 'FieldColorDesignation',
Expand Down
46 changes: 25 additions & 21 deletions stories/ListBox.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react';
import { css } from '@emotion/react';
import { Meta, Story } from '@storybook/react';
import { ListBox, Item, ListBoxProps, Section, Provider } from '../src';

import { ThemeToggleWrap } from './components/ThemeToggleWrap';
const meta: Meta = {
title: 'ListBox',
component: ListBox,
Expand All @@ -14,11 +13,13 @@ const meta: Meta = {
export default meta;

const Template: Story<ListBoxProps<string>> = args => (
<ListBox style={{ width: 200 }} aria-label="Alignment">
<Item>Left</Item>
<Item>Middle</Item>
<Item>Right</Item>
</ListBox>
<ThemeToggleWrap>
<ListBox style={{ width: 200 }} aria-label="Alignment" {...args}>
<Item>Left</Item>
<Item>Middle</Item>
<Item>Right</Item>
</ListBox>
</ThemeToggleWrap>
);

// By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
Expand All @@ -40,7 +41,7 @@ function SelectableListBox() {
let [animalId, setAnimalId] = React.useState<any>();

return (
<>
<ThemeToggleWrap>
<ListBox
style={{ width: 200 }}
aria-label="Animals"
Expand All @@ -51,7 +52,7 @@ function SelectableListBox() {
{item => <Item>{item.name}</Item>}
</ListBox>
<p>Animal id: {animalId}</p>
</>
</ThemeToggleWrap>
);
}
const ListOptions: Story<ListBoxProps<string>> = args => {
Expand Down Expand Up @@ -118,18 +119,21 @@ export const listBoxWithSections = ListBoxWithSections.bind({});

const ListBoxMultiSelect: Story<ListBoxProps<string>> = args => {
return (
<ListBox
style={{ width: 200 }}
aria-label="Pick your favorite"
selectionMode="multiple"
>
<Item key="Aardvark">Aardvark</Item>
<Item key="Kangaroo">Kangaroo</Item>
<Item key="Snake">Snake</Item>
<Item key="Danni">Danni</Item>
<Item key="Devon">Devon</Item>
<Item key="Ross">Ross</Item>
</ListBox>
<ThemeToggleWrap>
<ListBox
style={{ width: 200 }}
aria-label="Pick your favorite"
selectionMode="multiple"
{...args}
>
<Item key="Aardvark">Aardvark</Item>
<Item key="Kangaroo">Kangaroo</Item>
<Item key="Snake">Snake</Item>
<Item key="Danni">Danni</Item>
<Item key="Devon">Devon</Item>
<Item key="Ross">Ross</Item>
</ListBox>
</ThemeToggleWrap>
);
};

Expand Down
Loading
Loading