Files
react-test/docs/data/joy/components/modal/ResponsiveModal.tsx
how2ice 005cf56baf
Some checks failed
No response / noResponse (push) Has been cancelled
CI / Continuous releases (push) Has been cancelled
CI / test-dev (macos-latest) (push) Has been cancelled
CI / test-dev (ubuntu-latest) (push) Has been cancelled
CI / test-dev (windows-latest) (push) Has been cancelled
Maintenance / main (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
init project
2025-12-12 14:26:25 +09:00

62 lines
1.9 KiB
TypeScript

import * as React from 'react';
import Box from '@mui/joy/Box';
import Button from '@mui/joy/Button';
import Modal from '@mui/joy/Modal';
import ModalDialog from '@mui/joy/ModalDialog';
import Typography from '@mui/joy/Typography';
export default function ResponsiveModal() {
const [open, setOpen] = React.useState(false);
return (
<React.Fragment>
<Button variant="outlined" color="neutral" onClick={() => setOpen(true)}>
Open modal
</Button>
<Modal open={open} onClose={() => setOpen(false)}>
<ModalDialog
aria-labelledby="nested-modal-title"
aria-describedby="nested-modal-description"
sx={(theme) => ({
[theme.breakpoints.only('xs')]: {
top: 'unset',
bottom: 0,
left: 0,
right: 0,
borderRadius: 0,
transform: 'none',
maxWidth: 'unset',
},
})}
>
<Typography id="nested-modal-title" level="h2">
Are you absolutely sure?
</Typography>
<Typography id="nested-modal-description" textColor="text.tertiary">
This action cannot be undone. This will permanently delete your account
and remove your data from our servers.
</Typography>
<Box
sx={{
mt: 1,
display: 'flex',
gap: 1,
flexDirection: { xs: 'column', sm: 'row-reverse' },
}}
>
<Button variant="solid" color="primary" onClick={() => setOpen(false)}>
Continue
</Button>
<Button
variant="outlined"
color="neutral"
onClick={() => setOpen(false)}
>
Cancel
</Button>
</Box>
</ModalDialog>
</Modal>
</React.Fragment>
);
}