From a9115c87237728284c3ee35bf138b76ba6212c61 Mon Sep 17 00:00:00 2001 From: Dominik Serafin Date: Mon, 27 May 2019 18:26:46 +0200 Subject: [PATCH 1/4] [Dialog][scroll=body] Vertically center paper and fix fullWidth=false --- .../pages/components/dialogs/ScrollDialog.js | 88 ++++++++++++++++++- packages/material-ui/src/Dialog/Dialog.js | 28 +++++- 2 files changed, 111 insertions(+), 5 deletions(-) diff --git a/docs/src/pages/components/dialogs/ScrollDialog.js b/docs/src/pages/components/dialogs/ScrollDialog.js index 3f4093b22e8f18..59d2f462307733 100644 --- a/docs/src/pages/components/dialogs/ScrollDialog.js +++ b/docs/src/pages/components/dialogs/ScrollDialog.js @@ -5,11 +5,23 @@ import DialogActions from '@material-ui/core/DialogActions'; import DialogContent from '@material-ui/core/DialogContent'; import DialogContentText from '@material-ui/core/DialogContentText'; import DialogTitle from '@material-ui/core/DialogTitle'; +import FormControl from '@material-ui/core/FormControl'; // debug +import FormControlLabel from '@material-ui/core/FormControlLabel'; // debug +import InputLabel from '@material-ui/core/InputLabel'; // debug +import MenuItem from '@material-ui/core/MenuItem'; // debug +import Select from '@material-ui/core/Select'; // debug +import Switch from '@material-ui/core/Switch'; // debug + function ScrollDialog() { const [open, setOpen] = React.useState(false); const [scroll, setScroll] = React.useState('paper'); + const [filled, setFilled] = React.useState(false); // debug + const [maxWidth, setMaxWidth] = React.useState('sm'); // debug + const [fullWidth, setFullWidth] = React.useState(false); // debug + const [fullScreen, setFullScreen] = React.useState(false); // debug + const handleClickOpen = scrollType => () => { setOpen(true); setScroll(scrollType); @@ -19,11 +31,34 @@ function ScrollDialog() { setOpen(false); } + // debug + function toggleFilled() { + setFilled(!filled); + } + + // debug + function handleMaxWidthChange(event) { + setMaxWidth(event.target.value); + } + + // debug + function handleFullWidthChange(event) { + setFullWidth(event.target.checked); + } + + // debug + function handleFullScreenChange(event) { + setFullScreen(event.target.checked); + } + return (
Subscribe + + {/* debug start */} +
+ + maxWidth + + +
+ + } + label="Full width" + /> +
+ + } + label="Full screen" + /> + +
+
+ +
+
+ +
+
+ {/* debug end */} + - {[...new Array(50)] + {filled ? [...new Array(50)] .map( () => `Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.`, ) - .join('\n')} + .join('\n') : `Cras mattis consectetur.`} +
Subscribe - - {/* debug start */} -
- - maxWidth - - -
- - } - label="Full width" - /> -
- - } - label="Full screen" - /> - -
-
- -
-
- -
-
- {/* debug end */} - - {filled ? [...new Array(50)] + {[...new Array(50)] .map( () => `Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.`, ) - .join('\n') : `Cras mattis consectetur.`} + .join('\n')} -