forked from reactstrap/reactstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButtonDropdownPage.js
More file actions
198 lines (192 loc) · 6.17 KB
/
Copy pathButtonDropdownPage.js
File metadata and controls
198 lines (192 loc) · 6.17 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
/* eslint react/no-multi-comp: 0, react/prop-types: 0 */
import React from 'react';
import { PrismCode } from 'react-prism';
import Helmet from 'react-helmet';
import {
Button,
ButtonDropdown,
DropdownToggle,
DropdownItem,
DropdownMenu } from 'reactstrap';
import Example from '../examples/ButtonDropdownMulti';
import ExampleSplit from '../examples/ButtonDropdownMultiSplit';
import ButtonDropdownExample from '../examples/ButtonDropdown';
const ButtonDropdownExampleSource = require('!!raw!../examples/ButtonDropdown');
export default class ButtonDropdownPage extends React.Component {
constructor(props) {
super(props);
this.toggle = this.toggle.bind(this);
this.state = {
dropdownOpen: false
};
}
toggle() {
this.setState({
dropdownOpen: !this.state.dropdownOpen
});
}
render() {
return (
<div>
<Helmet title="Button Dropdown" />
<h3>Button Dropdown</h3>
<div className="docs-example">
<ButtonDropdownExample />
</div>
<pre>
<PrismCode className="language-jsx">
{ButtonDropdownExampleSource}
</PrismCode>
</pre>
<h4>Properties</h4>
<pre>
<PrismCode className="language-jsx">
{`ButtonDropdown.propTypes = {
disabled: PropTypes.bool,
dropup: PropTypes.bool,
group: PropTypes.bool,
isOpen: PropTypes.bool,
tag: PropTypes.string,
toggle: PropTypes.func
};
DropdownToggle.propTypes = {
caret: PropTypes.bool,
color: PropTypes.string,
disabled: PropTypes.bool,
onClick: PropTypes.func,
'data-toggle': PropTypes.string,
'aria-haspopup': PropTypes.bool
};`}
</PrismCode>
</pre>
<h3>Single button dropdowns</h3>
<div className="docs-example">
<div>
<Example color="primary" text="Primary" />
<Example color="secondary" text="Secondary" />
<Example color="success" text="Success" />
<Example color="info" text="Info" />
<Example color="warning" text="Warning" />
<Example color="danger" text="Danger" />
</div>
</div>
<pre>
<PrismCode className="language-jsx">
{`<ButtonDropdown isOpen={isOpen} toggle={toggle}>
<DropdownToggle caret color="primary">
Text
</DropdownToggle>
<DropdownMenu>
<DropdownItem header>Header</DropdownItem>
<DropdownItem disabled>Action</DropdownItem>
<DropdownItem>Another Action</DropdownItem>
<DropdownItem divider/>
<DropdownItem>Another Action</DropdownItem>
</DropdownMenu>
</ButtonDropdown>`}
</PrismCode>
</pre>
<h3>Split button dropdowns</h3>
<div className="docs-example">
<div>
<ExampleSplit color="primary" text="Primary" />
<ExampleSplit color="secondary" text="Secondary" />
<ExampleSplit color="success" text="Success" />
<ExampleSplit color="info" text="Info" />
<ExampleSplit color="warning" text="Warning" />
<ExampleSplit color="danger" text="Danger" />
</div>
</div>
<pre>
<PrismCode className="language-jsx">
{`<ButtonDropdown isOpen={isOpen} toggle={toggle}>
<Button id="caret" color="primary">{this.props.text}</Button>
<DropdownToggle caret color="primary" />
<DropdownMenu>
<DropdownItem header>Header</DropdownItem>
<DropdownItem disabled>Action</DropdownItem>
<DropdownItem>Another Action</DropdownItem>
<DropdownItem divider/>
<DropdownItem>Another Action</DropdownItem>
</DropdownMenu>
</ButtonDropdown>`}
</PrismCode>
</pre>
<h3>Sizing</h3>
<div className="docs-example">
<div>
<ButtonDropdown isOpen={this.state.btnLg} toggle={() => { this.setState({ btnLg: !this.state.btnLg }); }}>
<DropdownToggle caret size="lg">
Large Button
</DropdownToggle>
<DropdownMenu>
<DropdownItem>Another Action</DropdownItem>
<DropdownItem>Another Action</DropdownItem>
</DropdownMenu>
</ButtonDropdown>
</div>
<div className="mt-1">
<ButtonDropdown isOpen={this.state.btnSm} toggle={() => { this.setState({ btnSm: !this.state.btnSm }); }}>
<DropdownToggle caret size="sm">
Small Button
</DropdownToggle>
<DropdownMenu>
<DropdownItem>Another Action</DropdownItem>
<DropdownItem>Another Action</DropdownItem>
</DropdownMenu>
</ButtonDropdown>
</div>
</div>
<pre>
<PrismCode className="language-jsx">
{`<ButtonDropdown isOpen={isOpen} toggle={toggle}>
<DropdownToggle caret size="lg">
Large Button
</DropdownToggle>
<DropdownMenu>
<DropdownItem>Another Action</DropdownItem>
<DropdownItem>Another Action</DropdownItem>
</DropdownMenu>
</ButtonDropdown>
<ButtonDropdown isOpen={isOpen} toggle={toggle}>
<DropdownToggle caret size="sm">
Small Button
</DropdownToggle>
<DropdownMenu>
<DropdownItem>Another Action</DropdownItem>
<DropdownItem>Another Action</DropdownItem>
</DropdownMenu>
</ButtonDropdown>`}
</PrismCode>
</pre>
<h3>Dropup variation</h3>
<div className="docs-example">
<div>
<ButtonDropdown dropup isOpen={this.state.btnDropup} toggle={() => { this.setState({ btnDropup: !this.state.btnDropup }); }}>
<DropdownToggle caret size="lg">
Dropup
</DropdownToggle>
<DropdownMenu>
<DropdownItem>Another Action</DropdownItem>
<DropdownItem>Another Action</DropdownItem>
</DropdownMenu>
</ButtonDropdown>
</div>
</div>
<pre>
<PrismCode className="language-jsx">
{`<ButtonDropdown isOpen={isOpen} toggle={toggle} dropup>
<DropdownToggle caret caret size="lg">
Dropup
</DropdownToggle>
<DropdownMenu>
<DropdownItem>Another Action</DropdownItem>
<DropdownItem>Another Action</DropdownItem>
</DropdownMenu>
</ButtonDropdown>`}
</PrismCode>
</pre>
</div>
);
}
}