forked from reactstrap/reactstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCollapseEvents.js
More file actions
42 lines (34 loc) · 1.16 KB
/
Copy pathCollapseEvents.js
File metadata and controls
42 lines (34 loc) · 1.16 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
import React, { useState } from 'react';
import { Collapse, Button, CardBody, Card } from 'reactstrap';
const Example = (props) => {
const [collapse, setCollapse] = useState(false);
const [status, setStatus] = useState('Closed');
const onEntering = () => setStatus('Opening...');
const onEntered = () => setStatus('Opened');
const onExiting = () => setStatus('Closing...');
const onExited = () => setStatus('Closed');
const toggle = () => setCollapse(!collapse);
return (
<div>
<Button color="primary" onClick={toggle} style={{ marginBottom: '1rem' }}>Toggle</Button>
<h5>Current state: {status}</h5>
<Collapse
isOpen={collapse}
onEntering={onEntering}
onEntered={onEntered}
onExiting={onExiting}
onExited={onExited}
>
<Card>
<CardBody>
Anim pariatur cliche reprehenderit,
enim eiusmod high life accusamus terry richardson ad squid. Nihil
anim keffiyeh helvetica, craft beer labore wes anderson cred
nesciunt sapiente ea proident.
</CardBody>
</Card>
</Collapse>
</div>
);
}
export default Example;