diff options
| author | jackyzha0 <[email protected]> | 2020-05-12 21:09:50 -0700 |
|---|---|---|
| committer | jackyzha0 <[email protected]> | 2020-05-12 21:09:50 -0700 |
| commit | 07a3d810065e6e8b838c5e53bc7d18241e0ff3c5 (patch) | |
| tree | cddc9aa74c9ed1ff1ef8cdbec365ba516a14cff5 /frontend/src/components/PasswordModal.js | |
| parent | Merge pull request #18 from jackyzha0/no-pass-rendering (diff) | |
| download | ctrl-v-07a3d810065e6e8b838c5e53bc7d18241e0ff3c5.tar.xz ctrl-v-07a3d810065e6e8b838c5e53bc7d18241e0ff3c5.zip | |
password modal
Diffstat (limited to 'frontend/src/components/PasswordModal.js')
| -rw-r--r-- | frontend/src/components/PasswordModal.js | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/frontend/src/components/PasswordModal.js b/frontend/src/components/PasswordModal.js new file mode 100644 index 0000000..ef96f9d --- /dev/null +++ b/frontend/src/components/PasswordModal.js @@ -0,0 +1,73 @@ +import React from 'react'; +import Modal from 'react-modal'; +import styled from 'styled-components' +import { PassInput } from './Inputs' + +const modalStyles = { + content: { + top: '50%', + left: '50%', + transform: 'translate(-50%, -50%)', + width: '400px', + height: '250px', + border: '1px solid #11111188' + } +}; + +const PassProtected = styled.h3` + font-weight: 700 +` + +const RightPad = styled.div` + margin-right: 3em; +` + +const LeftPad = styled.div` + margin-left: 2em; +` + +class PasswordModal extends React.Component { + + componentWillMount() { + Modal.setAppElement('body'); + } + + constructor(props) { + super(props); + + this.submitPassword = this.submitPassword.bind(this); + } + + 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" + classNames + > + <form onSubmit={this.submitPassword}> + <LeftPad> + <PassProtected><span role="img" aria-label="warning">🚧 </span>err: password protected</PassProtected> + </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" /> + </LeftPad> + </form> + </Modal> + ); + } +} + +export default PasswordModal
\ No newline at end of file |