-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(accordion): update size prop types for v11 (#10509)
* chore(Accordion): updated size prop types * chore(accordion): updated another test Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
8f423cf
commit 1fcc0f6
Showing
4 changed files
with
172 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
163 changes: 163 additions & 0 deletions
163
packages/react/src/components/Accordion/next/Accordion.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
/** | ||
* Copyright IBM Corp. 2016, 2018 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
/* eslint-disable no-console */ | ||
|
||
import React from 'react'; | ||
import { action } from '@storybook/addon-actions'; | ||
import { | ||
withKnobs, | ||
boolean, | ||
number, | ||
select, | ||
text, | ||
} from '@storybook/addon-knobs'; | ||
import { | ||
default as Accordion, | ||
AccordionItem, | ||
AccordionSkeleton, | ||
} from '../../Accordion'; | ||
import Button from '../../Button'; | ||
import mdx from '../Accordion.mdx'; | ||
|
||
export default { | ||
title: 'Components/Accordion', | ||
component: Accordion, | ||
subcomponents: { | ||
AccordionItem, | ||
AccordionSkeleton, | ||
}, | ||
decorators: [withKnobs], | ||
parameters: { | ||
docs: { | ||
page: mdx, | ||
}, | ||
}, | ||
}; | ||
|
||
export const AccordionStory = () => ( | ||
<Accordion> | ||
<AccordionItem title="Section 1 title"> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim | ||
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea | ||
commodo consequat. | ||
</p> | ||
</AccordionItem> | ||
<AccordionItem title="Section 2 title"> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim | ||
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea | ||
commodo consequat. | ||
</p> | ||
</AccordionItem> | ||
<AccordionItem title="Section 3 title"> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim | ||
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea | ||
commodo consequat. | ||
</p> | ||
</AccordionItem> | ||
<AccordionItem title="Section 4 title"> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim | ||
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea | ||
commodo consequat. | ||
</p> | ||
</AccordionItem> | ||
</Accordion> | ||
); | ||
|
||
AccordionStory.storyName = 'Accordion'; | ||
|
||
export const Skeleton = () => <AccordionSkeleton open count={4} />; | ||
|
||
Skeleton.decorators = [ | ||
(story) => <div style={{ width: '500px' }}>{story()}</div>, | ||
]; | ||
|
||
const props = { | ||
onClick: action('onClick'), | ||
onHeadingClick: action('onHeadingClick'), | ||
}; | ||
|
||
const sizes = { | ||
'Small (sm)': 'sm', | ||
'Medium (md) - default': undefined, | ||
'Large (lg)': 'lg', | ||
}; | ||
|
||
export const Playground = () => ( | ||
<Accordion | ||
disabled={boolean('Disable entire Accordion (disabled)', false)} | ||
size={ | ||
select('Accordion heading size (size)', sizes, undefined) || undefined | ||
} | ||
align={select( | ||
'Accordion heading alignment (align)', | ||
['start', 'end'], | ||
'end' | ||
)}> | ||
<AccordionItem | ||
title={text('The title (title)', 'Section 1 title')} | ||
open={boolean('Open the section (open)', false)} | ||
{...props}> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim | ||
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea | ||
commodo consequat. | ||
</p> | ||
</AccordionItem> | ||
<AccordionItem title="Section 2 title" {...props}> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim | ||
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea | ||
commodo consequat. | ||
</p> | ||
</AccordionItem> | ||
<AccordionItem | ||
title="Section 3 title" | ||
{...props} | ||
disabled={boolean('Disable Section 3 (disabled)', true)}> | ||
<Button>This is a button.</Button> | ||
</AccordionItem> | ||
<AccordionItem | ||
title={ | ||
<span> | ||
Section 4 title (<em>the title can be a node</em>) | ||
</span> | ||
} | ||
{...props}> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim | ||
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea | ||
commodo consequat. | ||
</p> | ||
</AccordionItem> | ||
</Accordion> | ||
); | ||
|
||
export const SkeletonPlayground = () => ( | ||
<div style={{ width: '500px' }}> | ||
<AccordionSkeleton | ||
align={select( | ||
'Accordion heading alignment (align)', | ||
['start', 'end'], | ||
'end' | ||
)} | ||
open={boolean('Show first item opened (open)', true)} | ||
count={number('Set number of items (count)', 4)} | ||
/> | ||
</div> | ||
); |