web: components: Added new property 'scale' to the Button component
This commit is contained in:
parent
fb8b4be622
commit
f0063afabe
@ -60,6 +60,8 @@ const StyledButton = styled(ButtonWrapper).attrs((props) => ({
|
||||
: (props.primary ? '#A6DCF2' : '#FFFFFF'))
|
||||
};
|
||||
|
||||
${props => props.scale && `width: 100%;`}
|
||||
|
||||
padding: ${props =>
|
||||
(props.size === 'big' && (props.primary
|
||||
? (props.icon
|
||||
@ -195,6 +197,7 @@ Button.propTypes = {
|
||||
label: PropTypes.string,
|
||||
primary: PropTypes.bool,
|
||||
size: PropTypes.oneOf(['base', 'medium', 'big']),
|
||||
scale: PropTypes.bool,
|
||||
icon: PropTypes.node,
|
||||
|
||||
tabIndex: PropTypes.number,
|
||||
@ -211,6 +214,7 @@ Button.defaultProps = {
|
||||
label: '',
|
||||
primary: false,
|
||||
size: 'base',
|
||||
scale: false,
|
||||
icon: null,
|
||||
|
||||
tabIndex: -1,
|
||||
|
@ -22,7 +22,8 @@ Button is used for a action on a page.
|
||||
| ------------------ | -------- | :------: | --------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `label` | `string` | - | - | - | Button text |
|
||||
| `primary` | `bool` | - | - | - | Tells when the button should be primary |
|
||||
| `size` | `oneOf` | - | `base`, `middle`, `big`, `huge` | `base` | Size of button |
|
||||
| `size` | `oneOf` | - | `base`, `middle`, `big` | `base` | Size of button |
|
||||
| `scale` | `bool` | - | - | false | Scale width of button to 100% |
|
||||
| `isDisabled` | `bool` | - | - | - | Tells when the button should present a disabled state |
|
||||
| `isLoading` | `bool` | - | - | - | Tells when the button should show loader icon |
|
||||
| `onClick` | `func` | ✅ | - | - | What the button will trigger when clicked |
|
||||
|
@ -24,6 +24,7 @@ storiesOf('Components|Buttons', module)
|
||||
label={text('label', 'Base button')}
|
||||
primary={boolean('primary', true)}
|
||||
size={select('size', sizeOptions, 'big')}
|
||||
scale={boolean('scale', false)}
|
||||
|
||||
isLoading={boolean('isLoading', false)}
|
||||
isHovered={boolean('isHovered', false)}
|
||||
|
Loading…
Reference in New Issue
Block a user