File size: 2,668 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
import { Button, Card, Gridicon } from '@automattic/components';
import { PureComponent } from 'react';
import ButtonGroup from 'calypso/components/button-group';
class Buttons extends PureComponent {
static displayName = 'ButtonGroup';
state = {
compact: false,
};
toggleButtons = () => {
this.setState( { compact: ! this.state.compact } );
};
render() {
return (
<div>
{ /* eslint-disable-next-line jsx-a11y/anchor-is-valid, jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */ }
<a className="docs__design-toggle button" onClick={ this.toggleButtons }>
{ this.state.compact ? 'Normal Buttons' : 'Compact Buttons' }
</a>
<Card>
<div className="docs__design-button-group-row">
<ButtonGroup>
<Button compact={ this.state.compact }>Do thing</Button>
<Button compact={ this.state.compact }>Do another thing</Button>
</ButtonGroup>
</div>
<div className="docs__design-button-group-row">
<ButtonGroup>
<Button compact={ this.state.compact }>Button one</Button>
<Button compact={ this.state.compact }>Button two</Button>
<Button compact={ this.state.compact } scary>
Button Three
</Button>
</ButtonGroup>
</div>
<div className="docs__design-button-group-row">
<ButtonGroup>
<Button compact={ this.state.compact }>
<Gridicon icon="add-image" />
</Button>
<Button compact={ this.state.compact }>
<Gridicon icon="heart" />
</Button>
<Button compact={ this.state.compact }>
<Gridicon icon="briefcase" />
</Button>
<Button compact={ this.state.compact }>
<Gridicon icon="history" />
</Button>
</ButtonGroup>
</div>
<div className="docs__design-button-group-row">
<ButtonGroup>
<Button primary compact={ this.state.compact }>
Publish
</Button>
<Button primary compact={ this.state.compact }>
<Gridicon icon="calendar" />
</Button>
</ButtonGroup>
</div>
<div className="docs__design-button-group-row">
<ButtonGroup busy>
<Button compact={ this.state.compact }>Busy</Button>
<Button compact={ this.state.compact }>
<Gridicon icon="calendar" />
</Button>
</ButtonGroup>
<ButtonGroup busy primary>
<Button primary compact={ this.state.compact }>
Primary Busy
</Button>
<Button primary compact={ this.state.compact }>
<Gridicon icon="calendar" />
</Button>
</ButtonGroup>
</div>
</Card>
</div>
);
}
}
export default Buttons;
|