blob: 5c4ab8777a5abb72985f80179b31dbc144883272 (
plain) (
blame)
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
|
import React, { useRef } from 'react';
import Modal from 'react-modal';
import { Password } from '../Inputs'
import {ModalHeader, modalStyles, Form} from './shared'
import Error from '../Err';
import {SubmitButton} from "../Common/Button";
const PasswordModal = (props) => {
const ErrorLabel = useRef(null);
Modal.setAppElement('body');
function submitPassword(e) {
e.preventDefault();
const password = props.value
props.validateCallback(password, ErrorLabel.current.showMessage)
}
return(
<Modal
isOpen={props.hasPass && !props.validPass}
style={modalStyles}
contentLabel="enter paste password"
>
<Form onSubmit={submitPassword}>
<ModalHeader><span role="img" aria-label="warning">🚧 </span>err: password protected</ModalHeader>
<Password
placeholder="hunter2"
value={props.value}
onChange={props.onChange} />
<SubmitButton type="submit" value="continue" />
<Error ref={ErrorLabel} />
</Form>
</Modal>
);
}
export default PasswordModal
|