2020-04-26 20:33:39 +00:00
|
|
|
// @flow
|
|
|
|
import * as React from 'react';
|
|
|
|
import { select, withKnobs } from '@storybook/addon-knobs';
|
|
|
|
import Button from './button';
|
|
|
|
import styled from 'styled-components';
|
|
|
|
import SvgIcon, { IconEnum } from './svg-icon';
|
|
|
|
|
|
|
|
export default {
|
Storybook Sidebar Provisioning & WIP Implementation (#2125)
* Migrating dimensions, latest SVG, stubbing sidebar
* Revert "Migrating dimensions, latest SVG, stubbing sidebar"
This reverts commit 5014a68f52ac50fc62db5d42d2b49abda28efaea.
* Revert "Revert "Migrating dimensions, latest SVG, stubbing sidebar""
This reverts commit 28c130c8d8b3993f91f072de106d3ff223d6c55b.
* Post merge bootstrap & build
* Linting
* Updating Story Heirarchy
* Migrating legacy tooltip component
* Reverting spacing integration into core dimensions
* Cleaning up comments, tweaking CSS var usage
* Removing static height
* Cleaning up static CSS values, re-organizing sliding panel, fixing search icon
* adding flow def for autobind in new SB instance
* PR feedback, removing new vars/updating markup
* Fixing lint > flow error on type
2020-05-14 18:00:29 +00:00
|
|
|
title: '1st Party | Button',
|
2020-04-26 20:33:39 +00:00
|
|
|
decorators: [withKnobs],
|
|
|
|
};
|
|
|
|
|
|
|
|
const Wrapper: React.ComponentType<any> = styled.div`
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
& > * {
|
|
|
|
margin-right: 0.5rem;
|
|
|
|
margin-top: 0.8rem;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
Wrapper.displayName = '...';
|
|
|
|
|
2020-05-02 18:20:46 +00:00
|
|
|
const Padded: React.ComponentType<any> = styled.div`
|
|
|
|
margin: 2rem auto;
|
|
|
|
`;
|
|
|
|
Padded.displayName = '...';
|
|
|
|
|
|
|
|
const sizes = {
|
|
|
|
Default: 'default',
|
|
|
|
Small: 'small',
|
|
|
|
};
|
|
|
|
|
2020-04-26 20:33:39 +00:00
|
|
|
const variants = {
|
|
|
|
Outlined: 'outlined',
|
|
|
|
Contained: 'contained',
|
|
|
|
Text: 'text',
|
|
|
|
};
|
|
|
|
|
|
|
|
const themeColors = {
|
2020-05-02 18:20:46 +00:00
|
|
|
Default: null,
|
2020-04-26 20:33:39 +00:00
|
|
|
Surprise: 'surprise',
|
|
|
|
Info: 'info',
|
|
|
|
Success: 'success',
|
|
|
|
Notice: 'notice',
|
|
|
|
Warning: 'warning',
|
|
|
|
Danger: 'danger',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const outlined = () => (
|
|
|
|
<Button
|
|
|
|
variant={select('Variant', variants, 'outlined')}
|
2020-05-02 18:20:46 +00:00
|
|
|
size={select('Size', sizes, null)}
|
2020-04-26 20:33:39 +00:00
|
|
|
onClick={() => window.alert('Clicked!')}
|
2020-05-02 18:20:46 +00:00
|
|
|
bg={select('Background', themeColors, null)}>
|
2020-04-26 20:33:39 +00:00
|
|
|
Outlined
|
|
|
|
</Button>
|
|
|
|
);
|
|
|
|
|
|
|
|
export const text = () => (
|
|
|
|
<Button
|
|
|
|
variant={select('Variant', variants, 'text')}
|
|
|
|
onClick={() => window.alert('Clicked!')}
|
|
|
|
bg={select('Background', themeColors)}>
|
|
|
|
Text
|
|
|
|
</Button>
|
|
|
|
);
|
|
|
|
|
|
|
|
export const contained = () => (
|
|
|
|
<Button
|
|
|
|
variant={select('Variant', variants, 'contained')}
|
|
|
|
onClick={() => window.alert('Clicked!')}
|
|
|
|
bg={select('Background', themeColors)}>
|
|
|
|
Contained
|
|
|
|
</Button>
|
|
|
|
);
|
|
|
|
|
|
|
|
export const disabled = () => (
|
|
|
|
<Button onClick={() => window.alert('Clicked!')} bg={select('Background', themeColors)} disabled>
|
|
|
|
Can't Touch This
|
|
|
|
</Button>
|
|
|
|
);
|
|
|
|
|
|
|
|
export const withIcon = () => (
|
|
|
|
<Button onClick={() => window.alert('Clicked!')} bg={select('Background', themeColors)}>
|
|
|
|
Expand <SvgIcon icon={IconEnum.chevronDown} />
|
|
|
|
</Button>
|
|
|
|
);
|
|
|
|
|
2020-05-02 18:20:46 +00:00
|
|
|
export const reference = () => (
|
2020-04-26 20:33:39 +00:00
|
|
|
<React.Fragment>
|
2020-05-02 18:20:46 +00:00
|
|
|
{['default', 'small'].map(s => (
|
|
|
|
<Padded>
|
|
|
|
<h2><code>size={s}</code></h2>
|
|
|
|
<Wrapper>
|
|
|
|
<Button variant="contained" size={s}>
|
|
|
|
Default
|
|
|
|
</Button>
|
|
|
|
<Button bg="success" variant="contained" size={s}>
|
|
|
|
Success
|
|
|
|
</Button>
|
|
|
|
<Button bg="surprise" variant="contained" size={s}>
|
|
|
|
Surprise
|
|
|
|
</Button>
|
|
|
|
<Button bg="danger" variant="contained" size={s}>
|
|
|
|
Danger
|
|
|
|
</Button>
|
|
|
|
<Button bg="warning" variant="contained" size={s}>
|
|
|
|
Warning
|
|
|
|
</Button>
|
|
|
|
<Button bg="notice" variant="contained" size={s}>
|
|
|
|
Notice
|
|
|
|
</Button>
|
|
|
|
<Button bg="info" variant="contained" size={s}>
|
|
|
|
Info
|
|
|
|
</Button>
|
|
|
|
</Wrapper>
|
|
|
|
<Wrapper>
|
|
|
|
<Button variant="outlined" size={s}>
|
|
|
|
Default
|
|
|
|
</Button>
|
|
|
|
<Button bg="success" variant="outlined" size={s}>
|
|
|
|
Success
|
|
|
|
</Button>
|
|
|
|
<Button bg="surprise" variant="outlined" size={s}>
|
|
|
|
Surprise
|
|
|
|
</Button>
|
|
|
|
<Button bg="danger" variant="outlined" size={s}>
|
|
|
|
Danger
|
|
|
|
</Button>
|
|
|
|
<Button bg="warning" variant="outlined" size={s}>
|
|
|
|
Warning
|
|
|
|
</Button>
|
|
|
|
<Button bg="notice" variant="outlined" size={s}>
|
|
|
|
Notice
|
|
|
|
</Button>
|
|
|
|
<Button bg="info" variant="outlined" size={s}>
|
|
|
|
Info
|
|
|
|
</Button>
|
|
|
|
</Wrapper>
|
|
|
|
<Wrapper>
|
|
|
|
<Button variant="text" size={s}>
|
|
|
|
Default
|
|
|
|
</Button>
|
|
|
|
<Button bg="success" variant="text" size={s}>
|
|
|
|
Success
|
|
|
|
</Button>
|
|
|
|
<Button bg="surprise" variant="text" size={s}>
|
|
|
|
Surprise
|
|
|
|
</Button>
|
|
|
|
<Button bg="danger" variant="text" size={s}>
|
|
|
|
Danger
|
|
|
|
</Button>
|
|
|
|
<Button bg="warning" variant="text" size={s}>
|
|
|
|
Warning
|
|
|
|
</Button>
|
|
|
|
<Button bg="notice" variant="text" size={s}>
|
|
|
|
Notice
|
|
|
|
</Button>
|
|
|
|
<Button bg="info" variant="text" size={s}>
|
|
|
|
Info
|
|
|
|
</Button>
|
|
|
|
</Wrapper>
|
|
|
|
</Padded>
|
|
|
|
))}
|
2020-04-26 20:33:39 +00:00
|
|
|
</React.Fragment>
|
|
|
|
);
|