-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathLocal.jsx
43 lines (39 loc) · 1.28 KB
/
Local.jsx
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
import { Modal, ModalLink } from '@inertiaui/modal-react';
import Container from './Container';
import { useRef } from 'react';
export default function Local() {
const modalRef = useRef(null);
function closeModal() {
modalRef.current.close();
}
function alertModalId() {
alert(modalRef.current.id);
}
return (
<>
<Container>
<div className="flex justify-between">
<h2 className="text-lg font-medium text-gray-900">Local</h2>
<ModalLink
href="#local"
className="px-2 py-1 text-xs font-medium text-indigo-600 bg-indigo-100 rounded-md"
>
Open Local Modal
</ModalLink>
</div>
</Container>
<Modal name="local" ref={modalRef}>
This is a local modal
<ModalLink href="/roles/create">
Create Role
</ModalLink>
<button onClick={closeModal}>
Close Modal through Ref
</button>
<button onClick={alertModalId}>
Alert Modal ID
</button>
</Modal>
</>
);
}