TabsAccordion.js
17.8 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
/* eslint-disable */
import React from 'react';
import {
Row,
Col,
Button,
DropdownMenu,
TabContent,
TabPane,
Nav,
NavItem,
NavLink,
Collapse,
DropdownItem,
DropdownToggle,
UncontrolledDropdown
} from 'reactstrap';
import classnames from 'classnames';
class TabsAccordion extends React.Component {
constructor(props) {
super(props);
this.toggleFirstTabs = this.toggleFirstTabs.bind(this);
this.toggleSecondTabs = this.toggleSecondTabs.bind(this);
this.toggleThirdTabs = this.toggleThirdTabs.bind(this);
this.toggleAccordionFirst = this.toggleAccordionFirst.bind(this);
this.state = {
activeFirstTab: 'tab11',
activeSecondTab: 'tab22',
activeThirdTab: 'tab31',
dropdownOpen: false,
accordionFirst: [false, false, false],
accordionSecond: [false, true, false],
accordionSecondContent: [{
title: 'Collapsible Group Item', body: ` Get base styles and flexible support for collapsible components like accordions and navigation.
Using the collapse plugin, we built a simple accordion by extending the panel component.`,
}, {
title: 'Normal Text Insertion', body: `
Why don't use Lore Ipsum? I think if some one says don't use lore ipsum it's very
controversial point. I think the opposite actually. Everyone knows what is lore ipsum
- it is easy to understand if text is lore ipsum. You'll automatically skip -
because you know - it's just non-informative stub. But what if there some text like
this one? You start to read it! But the goal of this text is different. The goal is
the example. So a bit of Lore Ipsum is always very good practice. Keep it in mind!`,
}, {
title: 'Check It',
body: ' Why don\'t use Lore Ipsum? I think if some one says don\'t use lore ipsum it\'s very controversial point. I think the opposite actually.',
}],
accordionFirstContent: [{
title: 'Collapsible Group Item', body: ` Get base styles and flexible support for collapsible components like accordions and navigation.
Using the collapse plugin, we built a simple accordion by extending the panel component.`,
}, {
title: 'Random from the Web', body: `
<p><span class="fw-semi-bold">Light Blue</span> - is a next generation admin template based
on the latest Metro design. There are few reasons we want to tell you, why we have created it:
We didn't like the darkness of most of admin templates, so we created this light one.
We didn't like the high contrast of most of admin templates, so we created this unobtrusive one.
We searched for a solution of how to make widgets look like real widgets, so we decided that
deep background - is what makes widgets look real.
</p>
<p class="no-margin text-muted"><em>- Some One</em></p>
`,
}, {
title: 'Check It',
body: ' Why don\'t use Lore Ipsum? I think if some one says don\'t use lore ipsum it\'s very controversial point. I think the opposite actually.',
}],
};
}
toggleFirstTabs(tab) {
if (this.state.activeFirstTab !== tab) {
this.setState({
activeFirstTab: tab,
});
}
}
toggleSecondTabs(tab) {
if (this.state.activeSecondTab !== tab) {
this.setState({
activeSecondTab: tab,
});
}
}
toggleThirdTabs(tab) {
if (this.state.activeThirdTab !== tab) {
this.setState({
activeThirdTab: tab,
});
}
}
toggleAccordionFirst(id) {
const arr = [];
arr.length = this.state.accordionFirst.length;
arr.fill(false);
arr[id] = !this.state.accordionFirst[id];
this.setState({
accordionFirst: arr,
});
}
toggleAccordionSecond(id) {
const arr = [];
arr.length = this.state.accordionSecond.length;
arr.fill(false);
arr[id] = !this.state.accordionSecond[id];
this.setState({
accordionSecond: arr,
});
}
render() {
return (
<div>
<ol className="breadcrumb">
<li className="breadcrumb-item">YOU ARE HERE</li>
<li className="breadcrumb-item active">UI Tabs & Accordion</li>
</ol>
<h1 className="page-title">Tabs & Accordion - <span
className="fw-semi-bold"
>Components</span></h1>
{/* Tabs */}
<Row>
<Col md="6" xs="12">
<div className="clearfix">
<Nav tabs className="float-left bg-light">
<NavItem>
<NavLink
className={classnames({ active: this.state.activeFirstTab === 'tab11' })}
onClick={() => { this.toggleFirstTabs('tab11'); }}
>
<span>Basic</span>
</NavLink>
</NavItem>
<NavItem>
<NavLink
className={classnames({ active: this.state.activeFirstTab === 'tab12' })}
onClick={() => { this.toggleFirstTabs('tab12'); }}
>
<span>Assumtion</span>
</NavLink>
</NavItem>
<UncontrolledDropdown nav>
<DropdownToggle nav caret
className={classnames({
active: this.state.activeFirstTab === 'tab13' ||
this.state.activeFirstTab === 'tab14'
})}>
Dropdown
</DropdownToggle>
<DropdownMenu>
<DropdownItem onClick={() => {
this.toggleFirstTabs('tab13');
}}>@fat
</DropdownItem>
<DropdownItem onClick={() => {
this.toggleFirstTabs('tab14');
}}>@mdo
</DropdownItem>
</DropdownMenu>
</UncontrolledDropdown>
</Nav>
</div>
{/* tab content */}
<TabContent className='mb-lg' activeTab={this.state.activeFirstTab}>
<TabPane tabId="tab11">
<h3>Tabs-enabled widget</h3>
<p>You will never know exactly how something will go until you try it.</p>
<p>{`You can think three hundred times and still have no precise result. If you see
attractive girl all you need to do is to go and ask her to give you her phone.
You don’t
need to think about HOW it can turn out. All you have to do is to GO and DO IT.
It
should be super-fast and easy. No hesitation. You ask me: “What to do with these
fearful thoughts preventing me from doing that?” The answer is to ignore them,
because
they can’t disappear immediately.`}</p>
<p>The same thing is for startups and ideas. If you have an idea right away after
it appears in your mind you should go and make a first step to implement
it. </p>
<div className="float-right">
<Button color="inverse" className="mr-xs">Cancel</Button>
<Button color="primary">Some button</Button>
</div>
<div className="clearfix"/>
</TabPane>
<TabPane tabId="tab12">
<p>{`Why don't use Lore Ipsum? I think if some one says don't use lore ipsum it's
very controversial
point. I think the opposite actually. Everyone knows what is lore ipsum - it is
easy to understand if text is lore ipsum.`}</p>
<div className="clearfix">
<div className="btn-toolbar">
<a className="btn btn-default"> Check </a>
<a className="btn btn-primary"> Dance? </a>
</div>
</div>
</TabPane>
<TabPane tabId="tab13">
<p> If you will think too much it will sink in the swamp of never implemented
plans and
ideas or will just go away or will be implemented by someone else.</p>
<p><strong>5 months of doing everything to achieve nothing.</strong></p>
<p>{`You'll automatically skip - because you know - it's just non-informative stub.
But what if there some text like this one?`}</p>
</TabPane>
<TabPane tabId="tab14">
<blockquote className="blockquote-sm blockquote mb-xs">
Plan it? Make it!
</blockquote>
<p>The same thing is for startups and ideas. If you have an idea right away after
it appears
in your mind you should go and make a first step to implement it.</p>
</TabPane>
</TabContent>
</Col>
<Col md="6" xs="12">
<Row>
<Col xs="12" className="mb-5">
<Nav className="bg-light" tabs>
<NavItem>
<NavLink
className={classnames({ active: this.state.activeSecondTab === 'tab21' })}
onClick={() => { this.toggleSecondTabs('tab21'); }}
>
<span>Basic</span>
</NavLink>
</NavItem>
<NavItem>
<NavLink
className={classnames({ active: this.state.activeSecondTab === 'tab22' })}
onClick={() => { this.toggleSecondTabs('tab22'); }}
>
<span>Assumtion</span>
</NavLink>
</NavItem>
<NavItem>
<NavLink
className={classnames({ active: this.state.activeSecondTab === 'tab23' })}
onClick={() => { this.toggleSecondTabs('tab23'); }}
>
<span>Works</span>
</NavLink>
</NavItem>
</Nav>
<TabContent className='mb-lg' activeTab={this.state.activeSecondTab}>
<TabPane tabId="tab21">
<p>
I had an idea named Great Work. It was a service aimed to help people find
their
passion.
Yes I know it sound crazy and super naïve but I worked on that. I started to
work
on
planning, graphics, presentations, pictures, descriptions, articles,
investments
and so on.
I worked on everything but not the project itself.
</p>
</TabPane>
<TabPane tabId="tab22">
<p>{`Why don't use Lore Ipsum? I think if some one says don't use lore ipsum it's
very
controversial
point. I think the opposite actually. Everyone knows what is lore ipsum - it
is
easy to understand if text is lore ipsum.`}</p>
<div className="clearfix">
<div className="btn-toolbar">
<Button color="danger"> Check </Button>
<Button color="default"> Dance? </Button>
</div>
</div>
</TabPane>
<TabPane tabId="tab23">
<p> If you will think too much it will sink in the swamp of never implemented
plans
and
ideas or will just go away or will be implemented by someone else.</p>
<p><strong>5 months of doing everything to achieve nothing.</strong></p>
<p>{`You'll automatically skip - because you know - it's just non-informative
stub.
But what if there some text like this one?`}</p>
</TabPane>
</TabContent>
</Col>
</Row>
<Row>
<Col xs="12">
<Nav className="bg-light" tabs>
<NavItem>
<NavLink
className={classnames({ active: this.state.activeThirdTab === 'tab31' })}
onClick={() => { this.toggleThirdTabs('tab31'); }}
>
<span>Basic</span>
</NavLink>
</NavItem>
<NavItem>
<NavLink
className={classnames({ active: this.state.activeThirdTab === 'tab32' })}
onClick={() => { this.toggleThirdTabs('tab32'); }}
>
<span>Assumtion</span>
</NavLink>
</NavItem>
<NavItem>
<NavLink
className={classnames({ active: this.state.activeThirdTab === 'tab33' })}
onClick={() => { this.toggleThirdTabs('tab33'); }}
>
<span>Works</span>
</NavLink>
</NavItem>
</Nav>
<TabContent className='mb-lg' activeTab={this.state.activeThirdTab}>
<TabPane tabId="tab31">
<p>
I had an idea named Great Work. It was a service aimed to help people find
their
passion.
Yes I know it sound crazy and super naïve but I worked on that. I started to
work
on
planning, graphics, presentations, pictures, descriptions, articles,
investments
and so on.
I worked on everything but not the project itself.
</p>
</TabPane>
<TabPane tabId="tab32">
<p>{`Why don't use Lore Ipsum? I think if some one says don't use lore ipsum it's
very
controversial
point. I think the opposite actually. Everyone knows what is lore ipsum - it
is
easy to understand if text is lore ipsum.`}</p>
<div className="clearfix">
<div className="btn-toolbar">
<Button color="danger"> Check </Button>
<Button color="default"> Dance? </Button>
</div>
</div>
</TabPane>
<TabPane tabId="tab33">
<p> If you will think too much it will sink in the swamp of never implemented
plans
and
ideas or will just go away or will be implemented by someone else.</p>
<p><strong>5 months of doing everything to achieve nothing.</strong></p>
<p>{`You'll automatically skip - because you know - it's just non-informative
stub.
But what if there some text like this one?`}</p>
</TabPane>
</TabContent>
</Col>
</Row>
</Col>
</Row>
{/* Accordion */}
<Row className="mt-xs">
<Col md="6" xs="12" className='mb-lg'>
{this.state.accordionFirstContent.map((element, index) => (
<div className="card panel mb-xs" key={`accord-one-${index.toString()}`}>
{ /* eslint-disable */ }
<div
className="card-header panel-header bg-light" role="button"
onClick={() => { this.toggleAccordionFirst(index); }}
>
{ /* eslint-enable */ }
<div className="mb-0">
{/* eslint-disable-next-line */}
<a className="accordion-toggle" role="button">
{element.title}
<i className={`fa fa-angle-down ${this.state.accordionFirst[index] ? 'expanded' : ''}`} />
</a>
</div>
</div>
<Collapse className="panel-body" isOpen={this.state.accordionFirst[index]}>
<div className="card-body" dangerouslySetInnerHTML={{ __html: element.body }} />
</Collapse>
</div>))}
</Col>
<Col md="6" xs="12" className='mb-lg'>
{this.state.accordionSecondContent.map((element, index) => (<div className="card panel mb-xs" key={`accord-one-${index.toString()}`}>
{ /* eslint-disable */ }
<div
className="card-header panel-header bg-light" role="button"
onClick={() => { this.toggleAccordionSecond(index); }}
>
{ /* eslint-enable */ }
<div className="mb-0">
{/* eslint-disable-next-line */}
<a className="accordion-toggle" role="button">
{element.title}
<i className="fa fa-angle-down float-right" />
</a>
</div>
</div>
<Collapse className="panel-body" isOpen={this.state.accordionSecond[index]}>
<div className="card-body" dangerouslySetInnerHTML={{ __html: element.body }} />
</Collapse>
</div>))}
</Col>
</Row>
</div>);
}
}
export default TabsAccordion;