forked from reactstrap/reactstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInputGroupPage.js
More file actions
132 lines (123 loc) · 4.45 KB
/
InputGroupPage.js
File metadata and controls
132 lines (123 loc) · 4.45 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
/* eslint react/no-multi-comp: 0, react/prop-types: 0 */
import React from 'react';
import { PrismCode } from 'react-prism';
import PageTitle from '../UI/PageTitle';
import SectionTitle from '../UI/SectionTitle';
import OverviewExample from '../examples/InputGroupOverview';
const OverviewExampleSource = require('!!raw-loader!../examples/InputGroupOverview');
import AddonExample from '../examples/InputGroupAddon';
const AddonExampleSource = require('!!raw-loader!../examples/InputGroupAddon');
import AddonSizingExample from '../examples/InputGroupSizing';
const AddonSizingExampleSource = require('!!raw-loader!../examples/InputGroupSizing');
import ButtonExample from '../examples/InputGroupButton';
const ButtonExampleSource = require('!!raw-loader!../examples/InputGroupButton');
import ButtonShorthandExample from '../examples/InputGroupButtonShorthand';
const ButtonShorthandExampleSource = require('!!raw-loader!../examples/InputGroupButtonShorthand');
export default class InputGroupPage 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>
<PageTitle title="Input Group" />
<div className="docs-example">
<OverviewExample />
</div>
<pre>
<PrismCode className="language-jsx">
{OverviewExampleSource}
</PrismCode>
</pre>
<h4>Properties</h4>
<pre>
<PrismCode className="language-jsx">
{`InputGroup.propTypes = {
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
size: PropTypes.string,
className: PropTypes.string
};
InputGroupAddOn.propTypes = {
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
addonType: PropTypes.oneOf(['prepend', 'append']).isRequired,
className: PropTypes.string
};
InputGroupButton.propTypes = {
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
addonType: PropTypes.oneOf(['prepend', 'append']).isRequired,
children: PropTypes.node,
groupClassName: PropTypes.string, // only used in shorthand
groupAttributes: PropTypes.object, // only used in shorthand
className: PropTypes.string
};`}
</PrismCode>
</pre>
<SectionTitle>Addons</SectionTitle>
<div className="docs-example">
<div>
<AddonExample />
</div>
</div>
<pre>
<PrismCode className="language-jsx">
{AddonExampleSource}
</PrismCode>
</pre>
<SectionTitle>Addon Sizing</SectionTitle>
<div className="docs-example">
<div>
<AddonSizingExample />
</div>
</div>
<pre>
<PrismCode className="language-jsx">
{AddonSizingExampleSource}
</PrismCode>
</pre>
<SectionTitle>Buttons / Dropdowns</SectionTitle>
<div className="docs-example">
<div>
<ButtonExample />
</div>
</div>
<pre>
<PrismCode className="language-jsx">
{ButtonExampleSource}
</PrismCode>
</pre>
<SectionTitle>Button Shorthand (DEPRECATED)</SectionTitle>
<p>
Button shorthand is deprecated. Below are the updated examples of how to use <code>InputGroupAddon</code> to
accomplish the same output.
</p>
<p style={{ textDecoration: 'line-through' }}>
Button shorthand is a convenience method for adding just a button. It is triggered when only a single string
is the child. A Button will be created and all of the props will be passed to it with the exception of
<code>groupClassName</code> and <code>groupAttributes</code>, which are used to added classes and attributes
to the wrapping container. This means you can add your <code>onClick</code> and other handlers directly to
<code>InputGroupButton</code>. If you want your string to not be wrapped in a button, then you really want to
use <code>InputGroupAddon</code> (see Addons above for that).
</p>
<div className="docs-example">
<div>
<ButtonShorthandExample />
</div>
</div>
<pre>
<PrismCode className="language-jsx">
{ButtonShorthandExampleSource}
</PrismCode>
</pre>
</div>
);
}
}