Navbar.js
5.91 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
import React, { Component } from 'react';
import {
Row,
Col,
Breadcrumb,
BreadcrumbItem,
Navbar,
NavbarBrand,
NavbarToggler,
Collapse,
Nav,
NavItem,
NavLink,
} from 'reactstrap';
import Widget from '../../../../components/Widget';
class NavbarExamples extends Component {
state = {
navs: [false, false, false, false],
}
toggle(id) {
const newState = Array(4).fill(false);
if (!this.state.navs[id]) {
newState[id] = true;
}
this.setState({ navs: newState });
}
render() {
return (
<div>
<Breadcrumb>
<BreadcrumbItem>YOU ARE HERE</BreadcrumbItem>
<BreadcrumbItem active>UI Navbar</BreadcrumbItem>
</Breadcrumb>
<Row>
<Col xs={12} md={9}>
<Widget
title={<h5>Navbar <span className="fw-semi-bold">Example</span></h5>}
close collapse
>
<p>Here’s what you need to know before getting started with the navbar:</p>
<ui>
<li>Navbars require a wrapping <code><Navbar></code> with <code>expand="*"</code> for
responsive collapsing and color scheme classes.</li>
<li>Navbars and their contents are fluid by default. Use optional containers
to limit their horizontal width.</li>
<li>Use our spacing and flex utility classes for controlling spacing and alignment within navbars.</li>
<li>Navbars are responsive by default, but you can easily modify them to change that. Responsive
behavior depends on our Collapse JavaScript plugin.</li>
<li>Navbars are hidden by default when printing. Force them to be printed by adding <code>.d-print</code>
to the <code>.navbar</code>. See the display utility class.</li>
</ui>
<Navbar className="px-2 mt-lg" color="light" light expand="md">
<NavbarBrand href="/">Navbar</NavbarBrand>
<NavbarToggler className="ml-auto" onClick={() => this.toggle(0)} />
<Collapse isOpen={this.state.navs[0]} navbar>
<Nav className="ml-auto" navbar>
<NavItem>
<NavLink>Home</NavLink>
</NavItem>
<NavItem>
<NavLink>Features</NavLink>
</NavItem>
<NavItem>
<NavLink>Pricing</NavLink>
</NavItem>
<NavItem>
<NavLink disabled>Disabled</NavLink>
</NavItem>
</Nav>
</Collapse>
</Navbar>
</Widget>
</Col>
<Col xs={12} md={9}>
<Widget
title={<h5>Navbar <span className="fw-semi-bold">Example</span></h5>}
close collapse
>
<p>Theming the navbar has never been easier thanks to the combination of
theming classes and background-color utilities. Choose from <code>color="light"</code>
for use with light background colors, or <code>color="dark"</code> for dark background
colors. Then, customize with <code>.bg-*</code> utilities.</p>
<Navbar className="px-2 mt-lg" color="dark" dark expand="md">
<NavbarBrand href="/">Navbar</NavbarBrand>
<NavbarToggler className="ml-auto" onClick={() => this.toggle(1)} />
<Collapse isOpen={this.state.navs[1]} navbar>
<Nav className="ml-auto" navbar>
<NavItem>
<NavLink>Home</NavLink>
</NavItem>
<NavItem>
<NavLink>Features</NavLink>
</NavItem>
<NavItem>
<NavLink>Pricing</NavLink>
</NavItem>
<NavItem>
<NavLink disabled>Disabled</NavLink>
</NavItem>
</Nav>
</Collapse>
</Navbar>
<Navbar className="px-2 mt-lg" color="primary" dark expand="md">
<NavbarBrand href="/">Navbar</NavbarBrand>
<NavbarToggler className="ml-auto" onClick={() => this.toggle(2)} />
<Collapse isOpen={this.state.navs[2]} navbar>
<Nav className="ml-auto" navbar>
<NavItem>
<NavLink>Home</NavLink>
</NavItem>
<NavItem>
<NavLink>Features</NavLink>
</NavItem>
<NavItem>
<NavLink>Pricing</NavLink>
</NavItem>
<NavItem>
<NavLink disabled>Disabled</NavLink>
</NavItem>
</Nav>
</Collapse>
</Navbar>
<Navbar className="px-2 mt-lg" color="light" light expand="md">
<NavbarBrand href="/">Navbar</NavbarBrand>
<NavbarToggler className="ml-auto" onClick={() => this.toggle(3)} />
<Collapse isOpen={this.state.navs[3]} navbar>
<Nav className="ml-auto" navbar>
<NavItem>
<NavLink>Home</NavLink>
</NavItem>
<NavItem>
<NavLink>Features</NavLink>
</NavItem>
<NavItem>
<NavLink>Pricing</NavLink>
</NavItem>
<NavItem>
<NavLink disabled>Disabled</NavLink>
</NavItem>
</Nav>
</Collapse>
</Navbar>
</Widget>
</Col>
</Row>
</div>
);
}
}
export default NavbarExamples;