Skip to content

Instantly share code, notes, and snippets.

@Jerga99
Created December 18, 2023 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jerga99/ef5a08e66b81b1daaa88da97abc601e5 to your computer and use it in GitHub Desktop.
Save Jerga99/ef5a08e66b81b1daaa88da97abc601e5 to your computer and use it in GitHub Desktop.
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