blob: 813c1e3bf86e6d3313ddacced4e2cda7d12152cc (
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
|
import React, { useRef } from 'react';
import Modal from 'react-modal';
import { Password } from '../Inputs'
import {ModalHeader, Padding, modalStyles, Form} from './shared'
import Error from '../Err';
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
value={props.value}
onChange={props.onChange} />
<input className="lt-button lt-shadow lt-hover" type="submit" value="continue" />
<Padding />
<Error ref={ErrorLabel} />
</Form>
</Modal>
);
}
export default PasswordModal
|