forked from reactstrap/reactstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButtonsPage.js
More file actions
129 lines (122 loc) · 4.87 KB
/
Copy pathButtonsPage.js
File metadata and controls
129 lines (122 loc) · 4.87 KB
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/* eslint react/no-multi-comp: 0, react/prop-types: 0 */
import React from 'react';
import { PrismCode } from 'react-prism';
import { Button } from 'reactstrap';
import PageTitle from '../UI/PageTitle';
import SectionTitle from '../UI/SectionTitle';
import ButtonExample from '../examples/Button';
const ButtonExampleSource = require('!!raw!../examples/Button');
import ButtonOutline from '../examples/ButtonOutline';
const ButtonOutlineSource = require('!!raw!../examples/ButtonOutline');
import ButtonStateful from '../examples/ButtonStateful';
const ButtonStatefulSource = require('!!raw!../examples/ButtonStateful');
export default class ButtonsPage extends React.Component {
render() {
return (
<div>
<PageTitle title="Buttons" />
<div className="docs-example">
<ButtonExample />
</div>
<pre>
<PrismCode className="language-jsx">
{ButtonExampleSource}
</PrismCode>
</pre>
<h4>Properties</h4>
<pre>
<PrismCode className="language-jsx">
{`Button.propTypes = {
active: PropTypes.bool,
block: PropTypes.bool,
color: PropTypes.string, // default: 'secondary'
disabled: PropTypes.bool,
// Pass in a Component to override default button element
// example: react-router Link
// default: 'button'
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
// ref will only get you a reference to the Button component, use innerRef to get a reference to the DOM element (for things like focus management).
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
onClick: PropTypes.func,
size: PropTypes.string
}`}
</PrismCode>
</pre>
<SectionTitle>Outline Buttons</SectionTitle>
<div className="docs-example">
<ButtonOutline />
</div>
<pre>
<PrismCode className="language-jsx">
{ButtonOutlineSource}
</PrismCode>
</pre>
<SectionTitle>Sizes</SectionTitle>
<div className="docs-example">
<Button color="primary" size="lg">Large Button</Button>{' '}
<Button color="secondary" size="lg">Large Button</Button>
</div>
<pre>
<PrismCode className="language-jsx">
{`<Button color="primary" size="lg">Large Button</Button>{' '}
<Button color="secondary" size="lg">Large Button</Button>`}
</PrismCode>
</pre>
<div className="docs-example">
<Button color="primary" size="sm">Small Button</Button>{' '}
<Button color="secondary" size="sm">Small Button</Button>
</div>
<pre>
<PrismCode className="language-jsx">
{`<Button color="primary" size="sm">Small Button</Button>{' '}
<Button color="secondary" size="sm">Small Button</Button>`}
</PrismCode>
</pre>
<div className="docs-example">
<Button color="primary" size="lg" block>Block level button</Button>
<Button color="secondary" size="lg" block>Block level button</Button>
</div>
<pre>
<PrismCode className="language-jsx">
{`<Button color="primary" size="lg" block>Block level button</Button>
<Button color="secondary" size="lg" block>Block level button</Button>`}
</PrismCode>
</pre>
<SectionTitle>Active State</SectionTitle>
<div className="docs-example">
<Button color="primary" size="lg" active>Primary link</Button>{' '}
<Button color="secondary" size="lg" active>Link</Button>
</div>
<pre>
<PrismCode className="language-jsx">
{`<Button color="primary" size="lg" active>Primary link</Button>{' '}
<Button color="secondary" size="lg" active>Link</Button>`}
</PrismCode>
</pre>
<SectionTitle>Disabled State</SectionTitle>
<div className="docs-example">
<Button color="primary" size="lg" disabled>Primary button</Button>{' '}
<Button color="secondary" size="lg" disabled>Button</Button>
</div>
<pre>
<PrismCode className="language-jsx">
{`<Button color="primary" size="lg" disabled>Primary button</Button>{' '}
<Button color="secondary" size="lg" disabled>Button</Button>`}
</PrismCode>
</pre>
<SectionTitle>Checkbox and Radio Buttons (Stateful Buttons)</SectionTitle>
<p>
In order to have checkbox and radio buttons, your component needs to manage the state of which button(s) are active/select. It is not in the opinion of this library to manage state within it's components so it is left up to you. Below is a simple example showcasing how this could be done using the components which already exist in this library.
</p>
<div className="docs-example">
<ButtonStateful />
</div>
<pre>
<PrismCode className="language-jsx">
{ButtonStatefulSource}
</PrismCode>
</pre>
</div>
);
}
}