Created
December 18, 2023 08:23
-
-
Save Jerga99/ef5a08e66b81b1daaa88da97abc601e5 to your computer and use it in GitHub Desktop.
This file contains 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
import React from "react"; | |
import { Provider } from "react-redux"; | |
import Modal from 'react-modal'; | |
import configureStore from "./redux/store"; | |
const store = configureStore(); | |
const customStyles = { | |
content: { | |
top: '50%', | |
left: '50%', | |
right: 'auto', | |
bottom: 'auto', | |
marginRight: '-50%', | |
transform: 'translate(-50%, -50%)', | |
}, | |
}; | |
const App = () => { | |
const [modalIsOpen, setIsOpen] = React.useState(false); | |
function openModal() { | |
setIsOpen(true); | |
} | |
function closeModal() { | |
setIsOpen(false); | |
} | |
return ( | |
<Provider store={store}> | |
<div> | |
<h1>Welcome to Your App</h1> | |
<button onClick={openModal}>Login</button> | |
<Modal | |
isOpen={modalIsOpen} | |
onRequestClose={closeModal} | |
style={customStyles} | |
contentLabel="Example Modal" | |
> | |
<button onClick={closeModal}>close</button> | |
<div>I am a modal</div> | |
<form> | |
<p>Handle Login here</p> | |
<input /> | |
<button>tab navigation</button> | |
<button>stays</button> | |
<button>inside</button> | |
<button>the modal</button> | |
</form> | |
</Modal> | |
</div> | |
</Provider> | |
); | |
}; | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment