Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Add docs page for unstyled Modal #31417

Merged
merged 57 commits into from
Mar 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
70fdc6c
init
mnajdova Mar 11, 2022
e8dac05
Merge branch 'master' into docs/modal
mnajdova Mar 14, 2022
454955c
Resolve TODOs
mnajdova Mar 14, 2022
4eb7899
Consistent demos
mnajdova Mar 14, 2022
88722aa
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
1ed46fb
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
30f0ef8
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
955c9d3
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
9402626
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
66a3945
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
afe58ff
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
b6fdc22
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
843e5ab
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
ab9a95a
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
9dd6828
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
2923898
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
cf02aba
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
535f7d6
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
803c085
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
3f32ba7
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
387c2de
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
2a5b1a9
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
eb718f5
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
da3bcff
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
2d18dd3
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
8ebfa49
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
c44cc43
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
4840e5a
Update docs/data/base/components/modal/modal.md
mnajdova Mar 14, 2022
6c46c25
exclude translation markdown from querying
siriwatknp Mar 15, 2022
dca49b9
fix mui-base modal markdown header
siriwatknp Mar 15, 2022
9cfb45a
run docs:api
siriwatknp Mar 15, 2022
7c04ed0
manually remove the material ui demo link
siriwatknp Mar 15, 2022
981ae45
Update docs/data/base/components/modal/modal.md
mnajdova Mar 15, 2022
9dcee51
Update docs/data/base/components/modal/modal.md
mnajdova Mar 15, 2022
4dcadee
Update docs/data/base/components/modal/modal.md
mnajdova Mar 15, 2022
7a71ae8
Update docs/data/base/components/modal/modal.md
mnajdova Mar 15, 2022
f3e12cf
prettier
mnajdova Mar 15, 2022
e8dc04d
Update docs/data/base/components/modal/modal.md
mnajdova Mar 15, 2022
2b10266
Update docs/data/base/components/modal/modal.md
mnajdova Mar 15, 2022
8ec8973
Performance section comment
mnajdova Mar 15, 2022
b1870d8
Update docs/data/base/components/modal/modal.md
mnajdova Mar 15, 2022
ebc606a
Update docs/data/base/components/modal/modal.md
mnajdova Mar 15, 2022
5a83ed6
Pancakes
mnajdova Mar 15, 2022
a0324bb
Merge branch 'docs/modal' of https://github.com/mnajdova/material-ui …
mnajdova Mar 15, 2022
0ea28bf
Update docs/data/base/components/modal/modal.md
mnajdova Mar 16, 2022
8921942
Update docs/data/base/components/modal/modal.md
mnajdova Mar 16, 2022
47d7d8e
Update docs/data/base/components/modal/modal.md
mnajdova Mar 16, 2022
25de2af
Update docs/data/base/components/modal/modal.md
michaldudak Mar 17, 2022
3f8d195
Update docs/data/base/components/modal/modal.md
mnajdova Mar 18, 2022
c065153
Update docs/data/base/components/modal/modal.md
mnajdova Mar 23, 2022
064bd63
Update docs/data/base/components/modal/modal.md
mnajdova Mar 23, 2022
682463d
improve demos in dark mode
mnajdova Mar 23, 2022
1e5b961
Merge branch 'master' into docs/modal
mnajdova Mar 24, 2022
e158d79
BackdropUnstyled component & small fixes
mnajdova Mar 24, 2022
3bf90e3
Fix lint issues
mnajdova Mar 24, 2022
747593d
Update docs/data/base/components/modal/modal.md
mnajdova Mar 25, 2022
4b10c9b
Merge branch 'master' into docs/modal
mnajdova Mar 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions docs/data/base/components/modal/KeepMountedModal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { styled, Box } from '@mui/system';
import ModalUnstyled from '@mui/base/ModalUnstyled';

const BackdropUnstyled = React.forwardRef((props, ref) => {
const { open, className, ...other } = props;
return (
<div
className={clsx({ 'MuiBackdrop-open': open }, className)}
ref={ref}
{...other}
/>
);
});

BackdropUnstyled.propTypes = {
className: PropTypes.string.isRequired,
open: PropTypes.bool,
};

const Modal = styled(ModalUnstyled)(`
position: fixed;
z-index: 1300;
right: 0;
bottom: 0;
top: 0;
left: 0;
display: flex;
align-items: center;
justify-content: center;
&.MuiModal-hidden {
visibility: hidden;
}
`);

const Backdrop = styled(BackdropUnstyled)`
z-index: -1;
position: fixed;
right: 0;
bottom: 0;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.5);
-webkit-tap-highlight-color: transparent;
`;

const style = (theme) => ({
width: 400,
bgcolor: theme.palette.mode === 'dark' ? '#0A1929' : 'white',
border: '2px solid currentColor',
padding: '16px 32px 24px 32px',
});

export default function ModalUnstyledDemo() {
const [open, setOpen] = React.useState(false);
const handleOpen = () => setOpen(true);
const handleClose = () => setOpen(false);

return (
<div>
<button type="button" onClick={handleOpen}>
Open modal
</button>
<Modal
aria-labelledby="keep-mounted-modal-title"
aria-describedby="keep-mounted-modal-description"
open={open}
onClose={handleClose}
BackdropComponent={Backdrop}
keepMounted
>
<Box sx={style}>
<h2 id="keep-mounted-modal-title">Text in a modal</h2>
<p id="keep-mounted-modal-description">Aliquid amet deserunt earum!</p>
</Box>
</Modal>
</div>
);
}
78 changes: 78 additions & 0 deletions docs/data/base/components/modal/KeepMountedModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import * as React from 'react';
import clsx from 'clsx';
import { styled, Box, Theme } from '@mui/system';
import ModalUnstyled from '@mui/base/ModalUnstyled';

const BackdropUnstyled = React.forwardRef<
HTMLDivElement,
{ open?: boolean; className: string }
>((props, ref) => {
const { open, className, ...other } = props;
return (
<div
className={clsx({ 'MuiBackdrop-open': open }, className)}
ref={ref}
{...other}
/>
);
});

const Modal = styled(ModalUnstyled)(`
position: fixed;
z-index: 1300;
right: 0;
bottom: 0;
top: 0;
left: 0;
display: flex;
align-items: center;
justify-content: center;
&.MuiModal-hidden {
visibility: hidden;
}
`);

const Backdrop = styled(BackdropUnstyled)`
z-index: -1;
position: fixed;
right: 0;
bottom: 0;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.5);
-webkit-tap-highlight-color: transparent;
`;

const style = (theme: Theme) => ({
width: 400,
bgcolor: theme.palette.mode === 'dark' ? '#0A1929' : 'white',
border: '2px solid currentColor',
padding: '16px 32px 24px 32px',
});

export default function ModalUnstyledDemo() {
const [open, setOpen] = React.useState(false);
const handleOpen = () => setOpen(true);
const handleClose = () => setOpen(false);

return (
<div>
<button type="button" onClick={handleOpen}>
Open modal
</button>
<Modal
aria-labelledby="keep-mounted-modal-title"
aria-describedby="keep-mounted-modal-description"
open={open}
onClose={handleClose}
BackdropComponent={Backdrop}
keepMounted
>
<Box sx={style}>
<h2 id="keep-mounted-modal-title">Text in a modal</h2>
<p id="keep-mounted-modal-description">Aliquid amet deserunt earum!</p>
</Box>
</Modal>
</div>
);
}
16 changes: 16 additions & 0 deletions docs/data/base/components/modal/KeepMountedModal.tsx.preview
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<button type="button" onClick={handleOpen}>
Open modal
</button>
<Modal
aria-labelledby="keep-mounted-modal-title"
aria-describedby="keep-mounted-modal-description"
open={open}
onClose={handleClose}
BackdropComponent={Backdrop}
keepMounted
>
<Box sx={style}>
<h2 id="keep-mounted-modal-title">Text in a modal</h2>
<p id="keep-mounted-modal-description">Aliquid amet deserunt earum!</p>
</Box>
</Modal>
77 changes: 77 additions & 0 deletions docs/data/base/components/modal/ModalUnstyled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { styled, Box } from '@mui/system';
import ModalUnstyled from '@mui/base/ModalUnstyled';

const BackdropUnstyled = React.forwardRef((props, ref) => {
const { open, className, ...other } = props;
return (
<div
className={clsx({ 'MuiBackdrop-open': open }, className)}
ref={ref}
{...other}
/>
);
});

BackdropUnstyled.propTypes = {
className: PropTypes.string.isRequired,
open: PropTypes.bool,
};

const Modal = styled(ModalUnstyled)`
position: fixed;
z-index: 1300;
right: 0;
bottom: 0;
top: 0;
left: 0;
display: flex;
align-items: center;
justify-content: center;
`;

const Backdrop = styled(BackdropUnstyled)`
z-index: -1;
position: fixed;
right: 0;
bottom: 0;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.5);
-webkit-tap-highlight-color: transparent;
`;

const style = (theme) => ({
width: 400,
bgcolor: theme.palette.mode === 'dark' ? '#0A1929' : 'white',
border: '2px solid currentColor',
padding: '16px 32px 24px 32px',
});

export default function ModalUnstyledDemo() {
const [open, setOpen] = React.useState(false);
const handleOpen = () => setOpen(true);
const handleClose = () => setOpen(false);

return (
<div>
<button type="button" onClick={handleOpen}>
Open modal
</button>
<Modal
aria-labelledby="unstyled-modal-title"
aria-describedby="unstyled-modal-description"
open={open}
onClose={handleClose}
BackdropComponent={Backdrop}
>
<Box sx={style}>
<h2 id="unstyled-modal-title">Text in a modal</h2>
<p id="unstyled-modal-description">Aliquid amet deserunt earum!</p>
</Box>
</Modal>
</div>
);
}
74 changes: 74 additions & 0 deletions docs/data/base/components/modal/ModalUnstyled.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import * as React from 'react';
import clsx from 'clsx';
import { styled, Box, Theme } from '@mui/system';
import ModalUnstyled from '@mui/base/ModalUnstyled';

const BackdropUnstyled = React.forwardRef<
HTMLDivElement,
{ open?: boolean; className: string }
>((props, ref) => {
const { open, className, ...other } = props;
return (
<div
className={clsx({ 'MuiBackdrop-open': open }, className)}
ref={ref}
{...other}
/>
);
});

const Modal = styled(ModalUnstyled)`
position: fixed;
z-index: 1300;
right: 0;
bottom: 0;
top: 0;
left: 0;
display: flex;
align-items: center;
justify-content: center;
`;

const Backdrop = styled(BackdropUnstyled)`
z-index: -1;
position: fixed;
right: 0;
bottom: 0;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.5);
-webkit-tap-highlight-color: transparent;
`;

const style = (theme: Theme) => ({
width: 400,
bgcolor: theme.palette.mode === 'dark' ? '#0A1929' : 'white',
border: '2px solid currentColor',
padding: '16px 32px 24px 32px',
});

export default function ModalUnstyledDemo() {
const [open, setOpen] = React.useState(false);
const handleOpen = () => setOpen(true);
const handleClose = () => setOpen(false);

return (
<div>
<button type="button" onClick={handleOpen}>
Open modal
</button>
<Modal
aria-labelledby="unstyled-modal-title"
aria-describedby="unstyled-modal-description"
open={open}
onClose={handleClose}
BackdropComponent={Backdrop}
>
<Box sx={style}>
<h2 id="unstyled-modal-title">Text in a modal</h2>
<p id="unstyled-modal-description">Aliquid amet deserunt earum!</p>
</Box>
</Modal>
</div>
);
}
15 changes: 15 additions & 0 deletions docs/data/base/components/modal/ModalUnstyled.tsx.preview
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<button type="button" onClick={handleOpen}>
Open modal
</button>
<Modal
aria-labelledby="unstyled-modal-title"
aria-describedby="unstyled-modal-description"
open={open}
onClose={handleClose}
BackdropComponent={Backdrop}
>
<Box sx={style}>
<h2 id="unstyled-modal-title">Text in a modal</h2>
<p id="unstyled-modal-description">Aliquid amet deserunt earum!</p>
</Box>
</Modal>
Loading