diff options
| author | jackyzha0 <[email protected]> | 2020-05-13 23:34:12 -0700 |
|---|---|---|
| committer | jackyzha0 <[email protected]> | 2020-05-13 23:34:12 -0700 |
| commit | 28f0e55475ecac41034e3fac8c48ea0a332d364c (patch) | |
| tree | 421ab164e447c63cb163aff4f081072385d8ca4f /frontend/src/components/modals/PasswordModal.js | |
| parent | use var (diff) | |
| download | ctrl-v-28f0e55475ecac41034e3fac8c48ea0a332d364c.tar.xz ctrl-v-28f0e55475ecac41034e3fac8c48ea0a332d364c.zip | |
on new paste modal
Diffstat (limited to 'frontend/src/components/modals/PasswordModal.js')
| -rw-r--r-- | frontend/src/components/modals/PasswordModal.js | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/frontend/src/components/modals/PasswordModal.js b/frontend/src/components/modals/PasswordModal.js new file mode 100644 index 0000000..619e60a --- /dev/null +++ b/frontend/src/components/modals/PasswordModal.js @@ -0,0 +1,62 @@ +import React from 'react'; +import Modal from 'react-modal'; +import { PassInput } from '../Inputs' +import { RightPad, LeftPad, ModalHeader } from './shared' +import Error from '../Err'; + +const modalStyles = { + content: { + top: '50%', + left: '50%', + transform: 'translate(-50%, -50%)', + width: '400px', + height: '250px', + border: '1px solid #11111188' + } +}; + +class PasswordModal extends React.Component { + + componentWillMount() { + Modal.setAppElement('body'); + } + + constructor(props) { + super(props); + this.submitPassword = this.submitPassword.bind(this); + this.ErrorLabel = React.createRef(); + } + + submitPassword(event) { + const password = this.props.value + this.props.validateCallback(password) + event.preventDefault(); + } + + render() { + return( + <Modal + isOpen={this.props.hasPass && !this.props.validPass} + style={modalStyles} + contentLabel="enter paste password" + > + <form onSubmit={this.submitPassword}> + <LeftPad> + <ModalHeader><span role="img" aria-label="warning">🚧 </span>err: password protected</ModalHeader> + </LeftPad> + <RightPad> + <PassInput + value={this.props.value} + onChange={this.props.onChange} /> + </RightPad> + <LeftPad> + <input className="lt-button lt-shadow lt-hover" type="submit" value="continue" /> + <Error ref={this.ErrorLabel} /> + </LeftPad> + </form> + </Modal> + ); + } +} + +export default PasswordModal
\ No newline at end of file |