-
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.
fix(Button): make changes based on audit (#10610)
* fix(Button): make changes based on audit * docs(Button): add next folder back * docs(Button): remove excess stories * docs(Button): re-add stories for simplicity Co-authored-by: Taylor Jones <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
cb0ccf9
commit 1cb3a75
Showing
4 changed files
with
136 additions
and
5 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
130 changes: 130 additions & 0 deletions
130
packages/react/src/components/Button/next/Button.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,130 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { action } from '@storybook/addon-actions'; | ||
import { Add16 } from '@carbon/icons-react'; | ||
import { default as Button, ButtonSkeleton } from '../'; | ||
import ButtonSet from '../../ButtonSet'; | ||
|
||
export default { | ||
title: 'Components/Button', | ||
component: Button, | ||
subcomponents: { | ||
ButtonSet, | ||
ButtonSkeleton, | ||
}, | ||
argTypes: { | ||
kind: { | ||
options: [ | ||
'primary', | ||
'secondary', | ||
'tertiary', | ||
'ghost', | ||
'danger', | ||
'danger--tertiary', | ||
'danger--ghost', | ||
], | ||
control: { type: 'select' }, | ||
}, | ||
size: { | ||
options: ['sm', 'md', 'lg', 'xl', '2xl'], | ||
control: { type: 'select' }, | ||
}, | ||
children: { | ||
control: false, | ||
}, | ||
renderIcon: { | ||
control: false, | ||
}, | ||
as: { | ||
control: false, | ||
}, | ||
small: { | ||
table: { | ||
disable: true, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export const _Default = (args) => { | ||
return <Button {...args}>Button</Button>; | ||
}; | ||
|
||
export const Secondary = (args) => { | ||
return ( | ||
<Button kind="secondary" {...args}> | ||
Button | ||
</Button> | ||
); | ||
}; | ||
|
||
export const Tertiary = (args) => { | ||
return ( | ||
<Button kind="tertiary" {...args}> | ||
Button | ||
</Button> | ||
); | ||
}; | ||
|
||
export const Danger = (args) => { | ||
return ( | ||
<> | ||
<Button kind="danger" {...args}> | ||
Button | ||
</Button> | ||
| ||
<Button kind="danger--tertiary" {...args}> | ||
Tertiary Danger Button | ||
</Button> | ||
| ||
<Button kind="danger--ghost" {...args}> | ||
Ghost Danger Button | ||
</Button> | ||
</> | ||
); | ||
}; | ||
|
||
export const Ghost = (args) => { | ||
return ( | ||
<Button kind="ghost" {...args}> | ||
Button | ||
</Button> | ||
); | ||
}; | ||
|
||
export const IconButton = (args) => ( | ||
<Button | ||
renderIcon={Add16} | ||
iconDescription="Icon Description" | ||
hasIconOnly | ||
onClick={action('onClick')} | ||
{...args} | ||
/> | ||
); | ||
|
||
export const SetOfButtons = (args) => { | ||
return ( | ||
<ButtonSet> | ||
<Button kind="secondary" {...args}> | ||
Secondary button | ||
</Button> | ||
<Button kind="primary" {...args}> | ||
Primary button | ||
</Button> | ||
</ButtonSet> | ||
); | ||
}; | ||
|
||
export const Skeleton = () => ( | ||
<div> | ||
<ButtonSkeleton /> | ||
| ||
<ButtonSkeleton size="sm" /> | ||
</div> | ||
); |
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