Last active
December 5, 2021 15:41
-
-
Save kassshi/12ff039254bd2a2df298586a0578b411 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
| import { useState } from "react"; | |
| import "./App.css"; | |
| import { Button, Container } from "@mui/material"; | |
| import Modal from "react-modal"; | |
| const customStyles = { | |
| content: { | |
| top: "20%", | |
| left: "50%", | |
| right: "auto", | |
| bottom: "auto", | |
| marginRight: "-50%", | |
| transform: "translate(-50%, -50%)", | |
| minWidth: "40%", | |
| }, | |
| }; | |
| function App() { | |
| const [editModalIsOpen, setEditModalIsOpen] = useState(false); | |
| return ( | |
| <Container maxWidth="sm"> | |
| <Button | |
| variant="contained" | |
| color="primary" | |
| onClick={() => { | |
| setEditModalIsOpen(true); | |
| }} | |
| > | |
| モーダル開く | |
| </Button> | |
| <Modal isOpen={editModalIsOpen} style={customStyles}> | |
| モーダル開いた | |
| </Modal> | |
| </Container> | |
| ); | |
| } | |
| export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment