-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(button): update button component, docs, and story
- Loading branch information
1 parent
c7bfe15
commit bb31675
Showing
10 changed files
with
549 additions
and
210 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
module.exports = { | ||
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'], | ||
addons: ['@storybook/addon-links', '@storybook/addon-essentials'], | ||
addons: [ | ||
'@storybook/addon-controls', | ||
'@storybook/addon-links', | ||
'@storybook/addon-essentials', | ||
], | ||
}; |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
export const parameters = { | ||
actions: { argTypesRegex: "^on[A-Z].*" }, | ||
} | ||
actions: { argTypesRegex: '^on[A-Z].*' }, | ||
controls: { expanded: true }, | ||
}; |
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,152 @@ | ||
import React from 'react'; | ||
import { Button } from '.'; | ||
import { Story, Meta } from '@storybook/react/types-6-0'; | ||
import { Box, Flex } from '../layout'; | ||
|
||
export default { | ||
title: 'Button', | ||
}; | ||
import { Button, ButtonProps } from '.'; | ||
|
||
// variants | ||
export const Primary = () => <Button variant='primary'>Primary</Button>; | ||
|
||
export const Secondary = () => <Button variant='secondary'> Secondary</Button>; | ||
export default { | ||
title: 'Components/Button', | ||
component: Button, | ||
argTypes: { | ||
backgroundColor: { control: 'color' }, | ||
color: { control: 'color' }, | ||
children: { control: 'text' }, | ||
}, | ||
} as Meta; | ||
|
||
export const Ghost = () => <Button variant='ghost'>Ghost</Button>; | ||
const Template: Story<ButtonProps> = (args) => <Button {...args} />; | ||
|
||
// sizes | ||
// Base default button | ||
export const Base = Template.bind({}); | ||
Base.args = { | ||
children: 'Say Hello', | ||
onClick: () => alert('Hello Camara'), | ||
}; | ||
|
||
export const Large = () => ( | ||
<Button variant='primary' size='large'> | ||
Large | ||
</Button> | ||
// Variants | ||
export const Variants = (args: ButtonProps) => ( | ||
<Flex> | ||
<Button {...args} variant='primary'> | ||
Primary | ||
</Button> | ||
<Button {...args} variant='secondary'> | ||
Secondary | ||
</Button> | ||
<Button {...args} variant='ghost'> | ||
Ghost | ||
</Button> | ||
</Flex> | ||
); | ||
|
||
export const Medium = () => ( | ||
<Button variant='primary' size='medium'> | ||
Medium | ||
</Button> | ||
// sizes | ||
export const Sizes = (args: ButtonProps) => ( | ||
<Flex> | ||
<div> | ||
<Button {...args} size='large'> | ||
Large | ||
</Button> | ||
</div> | ||
<div> | ||
<Button {...args} size='medium'> | ||
Medium | ||
</Button> | ||
</div> | ||
<div> | ||
<Button {...args} size='small'> | ||
Small | ||
</Button> | ||
</div> | ||
</Flex> | ||
); | ||
|
||
export const Small = () => ( | ||
<Button variant='primary' size='small'> | ||
Small | ||
</Button> | ||
// disabled buttons | ||
export const Disabled = (args: ButtonProps) => ( | ||
<Flex> | ||
<div> | ||
<Button {...args} disabled variant='primary'> | ||
Primary | ||
</Button> | ||
</div> | ||
<div> | ||
<Button {...args} disabled variant='secondary'> | ||
Secondary | ||
</Button> | ||
</div> | ||
<div> | ||
<Button {...args} disabled variant='ghost'> | ||
Ghost | ||
</Button> | ||
</div> | ||
</Flex> | ||
); | ||
|
||
// disabled button | ||
export const Disabled = () => ( | ||
<Button variant='primary' disabled> | ||
Disabled | ||
</Button> | ||
// danger buttons | ||
export const Danger = (args: ButtonProps) => ( | ||
<Flex> | ||
<div> | ||
<Button {...args} danger variant='primary'> | ||
Primary | ||
</Button> | ||
</div> | ||
<div> | ||
<Button {...args} danger variant='secondary'> | ||
Secondary | ||
</Button> | ||
</div> | ||
<div> | ||
<Button {...args} danger variant='ghost'> | ||
Ghost | ||
</Button> | ||
</div> | ||
</Flex> | ||
); | ||
|
||
// danger button | ||
export const Danger = () => ( | ||
<Button variant='primary' danger> | ||
Danger | ||
</Button> | ||
// pill-shaped button | ||
export const Pill = (args: ButtonProps) => ( | ||
<Flex> | ||
<div> | ||
<Button {...args} pill variant='primary'> | ||
Primary | ||
</Button> | ||
</div> | ||
<div> | ||
<Button {...args} pill variant='secondary'> | ||
Secondary | ||
</Button> | ||
</div> | ||
<div> | ||
<Button {...args} pill variant='ghost'> | ||
Ghost | ||
</Button> | ||
</div> | ||
</Flex> | ||
); | ||
|
||
// pill-shaped button | ||
export const Pill = () => ( | ||
<Button variant='primary' pill> | ||
Camara | ||
</Button> | ||
// full width button | ||
export const Block = (args: ButtonProps) => ( | ||
<Box width={30}> | ||
<Button {...args} block variant='primary'> | ||
Primary | ||
</Button> | ||
<Button {...args} block variant='secondary'> | ||
Secondary | ||
</Button> | ||
<Button {...args} block variant='ghost'> | ||
Ghost | ||
</Button> | ||
</Box> | ||
); | ||
|
||
// With background color | ||
export const BackgroundColor = () => ( | ||
<Button variant='primary' pill backgroundColor='green'> | ||
export const BackgroundColor = (args: ButtonProps) => ( | ||
<Button {...args} pill backgroundColor='green'> | ||
Camara | ||
</Button> | ||
); | ||
|
||
// With color | ||
export const Color = () => ( | ||
<Button variant='primary' pill backgroundColor='#ffc108' color='#000000'> | ||
export const Color = (args: ButtonProps) => ( | ||
<Button {...args} pill backgroundColor='#ffc108' color='#000000'> | ||
Camara | ||
</Button> | ||
); |
Oops, something went wrong.