-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTermsOfServiceCheck.tsx
65 lines (61 loc) · 2.15 KB
/
TermsOfServiceCheck.tsx
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
import { type FC, useState } from 'react';
import { Badge, Button, Form, Modal } from 'react-bootstrap';
import TermsOfService from './TermsOfService';
import actionable from 'styles/actionable.module.css';
type TermsOfServiceCheck = {
accepted: boolean;
setAccepted: (accepted: boolean) => void;
};
/**
* Form element component to make sure user has accepted terms of service
*
* @param props
* @param props.accepted whether the terms of service have been accepted
* @param props.setAccepted set new acceptance state
*/
const TermsOfServiceCheck: FC<TermsOfServiceCheck> = ({ accepted, setAccepted }) => {
const [showTOS, setShowTOS] = useState(false);
return (
<>
<Form.Group>
<Form.Check
type="switch"
label={
<>
I have read and accept the{' '}
<Badge
bg="secondary"
onClick={() => setShowTOS(true)}
className={actionable['actionable']}
>
Terms of Service
</Badge>
</>
}
checked={accepted}
onChange={() => setAccepted(!accepted)}
/>
</Form.Group>
<Modal show={showTOS} onHide={() => setShowTOS(false)} size="lg">
<Modal.Header closeButton>
<Modal.Title>Acceptable Use Policy</Modal.Title>
</Modal.Header>
<Modal.Body>
<TermsOfService />
</Modal.Body>
<Modal.Footer>
<Button
variant="success"
onClick={() => {
setAccepted(true);
setShowTOS(false);
}}
>
Accept
</Button>
</Modal.Footer>
</Modal>
</>
);
};
export default TermsOfServiceCheck;