Created
April 2, 2020 03:17
-
-
Save jsmanifest/e357448730a9c0ee622a1cb0b1f696c8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const DeactivatorInput = ({ | |
component: Component = 'input', | |
style, | |
opened, | |
open: openModal, | |
close: closeModal, | |
...rest | |
}) => ( | |
<div> | |
<Component | |
type="email" | |
onKeyPress={(e) => { | |
const pressedEnter = e.charCode === 13 | |
if (pressedEnter) { | |
openModal() | |
} | |
}} | |
style={{ | |
minWidth: 200, | |
border: '1px solid rgba(0, 0, 0, 0.5)', | |
borderRadius: 4, | |
padding: '6px 12px', | |
...style, | |
}} | |
placeholder="Search a user to deactivate" | |
{...rest} | |
/> | |
<Modal isOpen={opened}> | |
<h1>Modal is opened</h1> | |
<hr /> | |
<button type="button" onClick={closeModal}> | |
Close | |
</button> | |
</Modal> | |
</div> | |
) | |
function App() { | |
return ( | |
<ControlPanel> | |
<DeactivatorInput /> | |
</ControlPanel> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment