-
Notifications
You must be signed in to change notification settings - Fork 96
/
demo-four.js
64 lines (57 loc) · 1.63 KB
/
demo-four.js
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
const React = require('react');
const { createRoot } = require('react-dom/client');
const AriaModal = require('../../src/react-aria-modal');
class DemoFour extends React.Component {
constructor(props) {
super(props);
this.state = {
modalActive: false
};
this.activateModal = this.activateModal.bind(this);
this.deactivateModal = this.deactivateModal.bind(this);
}
activateModal = () => {
this.setState({ modalActive: true });
};
deactivateModal = () => {
this.setState({ modalActive: false });
};
render() {
return (
<div>
<button onClick={this.activateModal}>
activate modal
</button>
<AriaModal
titleText="demo four"
onExit={this.deactivateModal}
initialFocus="#demo-four-deactivate"
mounted={this.state.modalActive}
underlayStyle={{ paddingTop: '2em' }}
>
<div id="demo-four-modal" className="modal">
<div className="modal-body">
<p>
Here is a modal
{' '}
<a href="#">with</a>
{' '}
<a href="#">some</a>
{' '}
<a href="#">focusable</a>
{' '}
parts.
</p>
</div>
<footer className="modal-footer">
<button id="demo-four-deactivate" onClick={this.deactivateModal}>
deactivate modal
</button>
</footer>
</div>
</AriaModal>
</div>
);
}
}
createRoot(document.getElementById('demo-four')).render(<DemoFour/>);