-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9e28c4f
commit eb23f77
Showing
2 changed files
with
114 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react'; | ||
import styled, { ThemeProvider } from 'styled-components'; | ||
import { Button as BaseButton } from '../../Button/Button'; | ||
import { theme as experimentalTheme, theme } from '../../../essentials/experimental/theme'; | ||
import { get } from '../../../utils/experimental/themeGet'; | ||
|
||
const ButtonStyled = styled(BaseButton).attrs({ theme })` | ||
border-radius: ${get('radii.3')}; | ||
padding: ${get('space.6')} ${get('space.4')}; | ||
// TODO: HOVER | ||
// TODO: SECONDARY VARIANT | ||
`; | ||
|
||
function Button() { | ||
return ( | ||
<ThemeProvider theme={experimentalTheme}> | ||
<ButtonStyled /> | ||
</ThemeProvider> | ||
); | ||
} | ||
|
||
export default Button; | ||
export { Button }; |
90 changes: 90 additions & 0 deletions
90
src/components/experimental/Button/docs/Button.stories.tsx
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,90 @@ | ||
import { StoryObj, Meta } from '@storybook/react'; | ||
import React from 'react'; | ||
import { Button } from '../Button'; | ||
import TrashIcon from '../../../../icons/actions/TrashIcon'; | ||
|
||
const meta: Meta = { | ||
title: 'Experimental/Components/Button', | ||
component: Button, | ||
args: { | ||
children: 'Button title' | ||
}, | ||
argTypes: { | ||
children: { | ||
description: 'Button caption' | ||
}, | ||
variant: { | ||
control: 'radio', | ||
options: ['primary', 'secondary', 'danger'] | ||
}, | ||
size: { | ||
control: 'radio', | ||
options: ['small', 'medium'] | ||
}, | ||
as: { | ||
description: 'html tag to use', | ||
control: 'text', | ||
table: { | ||
defaultValue: { | ||
summary: 'button' | ||
} | ||
} | ||
}, | ||
ref: { | ||
table: { | ||
disable: true | ||
} | ||
}, | ||
theme: { | ||
table: { | ||
disable: true | ||
} | ||
}, | ||
forwardedAs: { | ||
table: { | ||
disable: true | ||
} | ||
} | ||
} | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof Button>; | ||
|
||
export const Default: Story = {}; | ||
|
||
export const Secondary: Story = { | ||
args: { | ||
variant: 'secondary' | ||
} | ||
}; | ||
|
||
export const Danger: Story = { | ||
args: { | ||
variant: 'danger' | ||
} | ||
}; | ||
|
||
export const Disabled: Story = { | ||
args: { | ||
disabled: true | ||
} | ||
}; | ||
|
||
export const Small: Story = { | ||
args: { | ||
size: 'small' | ||
} | ||
}; | ||
|
||
export const WithIcon: Story = { | ||
args: { | ||
children: ( | ||
<> | ||
<TrashIcon size={20} /> Remove | ||
</> | ||
), | ||
variant: 'danger' | ||
} | ||
}; |