Skip to content

Commit 8138374

Browse files
committed
Added docs and sample code
1 parent 8b1ec75 commit 8138374

File tree

4 files changed

+89
-11
lines changed

4 files changed

+89
-11
lines changed

src/button/Button.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ const factory = (ripple, FontIcon) => {
3636
children, type, size, className, href, icon, iconAlignment, theme, ...others
3737
} = this.props;
3838
const element = href ? 'a' : 'button';
39-
4039
const classes = classnames(theme.button, theme[type], theme[size], className);
4140

4241
const props = {

src/button/readme.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
## Button
2+
3+
The base button component.
4+
5+
### Properties
6+
| Name | Type | Default | Description |
7+
|:-----|:-----|:-----|:-----|
8+
| `children` | `Any` | `null` | All child component to be rendered inside a button |
9+
| `type` | `String` | `default` | Represents the style to be applied for the button. Possible values are 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', and 'dark' |
10+
| `size` | `String` | `medium` | Defines the size of the button. Possible values are 'small', 'medium', and 'large' |
11+
| `className` | `String` | `''` | Set a class to style the Component |
12+
| `href` | `String` | `null` | Creates a link for the button. |
13+
| `icon` | `String`/`Element` | | Value of the icon |
14+
| `iconAlignment` | `String` | `left` | Set an alignment of the icon. Possible values are 'left', 'right' |
15+
16+
### Theme
17+
18+
| Name | Description|
19+
|:---------|:-----------|
20+
| `button` | Class used for the root element.|
21+
| `primary` | Class used for styling `primary` type buttons |
22+
| `secondary` | Class used for styling `secondary` type buttons |
23+
| `success` | Class used for styling `success` type buttons |
24+
| `danger` | Class used for styling `danger` type buttons |
25+
| `warning` | Class used for styling `warning` type buttons |
26+
| `info` | Class used for styling `info` type buttons |
27+
| `light` | Class used for styling `light` type buttons |
28+
| `dark` | Class used for styling `dark` type buttons |
29+
| `small` | Class used for styling `small` sized buttons |
30+
| `medium` | Class used for styling `medium` sized buttons |
31+
| `large` | Class used for styling `large` sized buttons |
32+
33+
### Usage
34+
```
35+
<div>
36+
<div>
37+
<h4>Buttons with diffent styles</h4>
38+
<Button>Default</Button>
39+
<Button type="primary">Primary</Button>
40+
<Button type="secondary">Secondary</Button>
41+
<Button type="success">Success</Button>
42+
<Button type="danger">Danger</Button>
43+
<Button type="warning">Warning</Button>
44+
<Button type="info">Info</Button>
45+
<Button type="light">Light</Button>
46+
<Button type="dark">Dark</Button>
47+
</div>
48+
49+
<div>
50+
<h4>Buttons with diffent sizes</h4>
51+
<Button type="primary" size="small">Small</Button>
52+
<Button type="primary" size="medium">Medium</Button>
53+
<Button type="primary" size="large">Large</Button>
54+
</div>
55+
56+
<div>
57+
<h4>Buttons with Icon</h4>
58+
<Button type="success" icon="done">Left Icon</Button>
59+
<Button type="success" icon="done" iconAlignment="right">Right Icon</Button>
60+
</div>
61+
</div>
62+
```

src/button/theme.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,15 @@
100100
}
101101

102102
.small {
103-
font-size: 12px;
103+
font-size: 11px;
104104
height: 28px;
105105
line-height: 28px;
106106
padding: 0 8px;
107107
min-width: 70px;
108108
}
109109

110110
.medium {
111-
font-size: 14px;
111+
font-size: 13px;
112112
height: 36px;
113113
line-height: 36px;
114114
padding: 0 12px;

src/index.js

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,31 @@ const Index = () => (
1717
</Card>
1818

1919
<div style={{ margin: '20px' }}>
20-
<Button size="medium" icon="favorite">Hello</Button>
21-
<Button type="danger" size="medium" icon="bookmark" iconAlignment="right">Hello</Button>
22-
<Button type="secondary" size="small">Hello</Button>
23-
<Button type="primary">Hello</Button>
24-
<Button type="success" size="large">Hello</Button>
25-
<Button type="warning" size="small">Hello</Button>
26-
<Button type="info" size="medium">Hello</Button>
27-
<Button type="dark" size="large">Hello</Button>
20+
<div>
21+
<h4>Buttons with diffent styles</h4>
22+
<Button>Default</Button>
23+
<Button type="primary">Primary</Button>
24+
<Button type="secondary">Secondary</Button>
25+
<Button type="success">Success</Button>
26+
<Button type="danger">Danger</Button>
27+
<Button type="warning">Warning</Button>
28+
<Button type="info">Info</Button>
29+
<Button type="light">Light</Button>
30+
<Button type="dark">Dark</Button>
31+
</div>
32+
33+
<div>
34+
<h4>Buttons with diffent sizes</h4>
35+
<Button type="primary" size="small">Small</Button>
36+
<Button type="primary" size="medium">Medium</Button>
37+
<Button type="primary" size="large">Large</Button>
38+
</div>
39+
40+
<div>
41+
<h4>Buttons with Icon</h4>
42+
<Button type="success" icon="done">Left Icon</Button>
43+
<Button type="success" icon="done" iconAlignment="right">Right Icon</Button>
44+
</div>
2845
</div>
2946
</div>
3047
);

0 commit comments

Comments
 (0)