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

[Dialog] Prepare deprecation of withMobileDialog #14992

Merged

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Mar 21, 2019

Prepare the deprecation of the withMobileDialog() higher order component. The hook API allows a simpler and more flexible solution:

-import withMobileDialog from '@material-ui/core/withMobileDialog';
+import useMediaQuery from '@material-ui/core/useMediaQuery';
+import { useTheme } from '@material-ui/core/styles';

function ResponsiveDialog(props) {
- const { fullScreen } = props;
+ const theme = useTheme();
+ const fullScreen = useMediaQuery(theme.breakpoints.down('sm'));
  const [open, setOpen] = React.useState(false);

// ...

-export default withMobileDialog()(ResponsiveDialog);
+export default ResponsiveDialog;

The deprecation will happen in the next few months, to prepare v5. For now, I have only removed it from the demo. For people that can't use hooks, withWidth is still a viable alternative, we might provide a withMediaQuery hook in the future.

@oliviertassinari oliviertassinari added breaking change component: dialog This is the name of the generic UI component, not the React module! deprecation New deprecation message and removed breaking change labels Mar 21, 2019
@oliviertassinari oliviertassinari changed the title [Dialog] Remove withMobileDialog [Dialog] Deprecate withMobileDialog Mar 21, 2019
@mui-pr-bot
Copy link

mui-pr-bot commented Mar 21, 2019

Details of bundle changes.

Comparing: d1a7d76...e6e251b

bundle parsed diff gzip diff prev parsed current parsed prev gzip current gzip
@material-ui/core 0.00% -0.00% 352,929 352,934 90,642 90,639
@material-ui/core/Paper 0.00% -0.01% 68,626 68,626 19,974 19,973
@material-ui/core/Paper.esm 0.00% -0.01% 62,358 62,358 19,075 19,073
@material-ui/core/Popper 0.00% -0.02% 30,460 30,460 10,528 10,526
@material-ui/core/styles/createMuiTheme 0.00% 0.00% 17,384 17,384 5,726 5,726
@material-ui/core/useMediaQuery 0.00% 0.00% 2,469 2,469 1,037 1,037
@material-ui/lab 0.00% -0.00% 152,181 152,181 44,533 44,532
@material-ui/styles 0.00% 0.00% 53,837 53,837 15,613 15,613
@material-ui/system 0.00% +0.02% 🔺 17,138 17,138 4,520 4,521
Button 0.00% -0.00% 90,918 90,918 26,970 26,969
Modal 0.00% -0.00% 84,712 84,712 25,262 25,261
colorManipulator 0.00% 0.00% 3,232 3,232 1,300 1,300
docs.landing 0.00% 0.00% 51,843 51,843 11,349 11,349
docs.main 0.00% 0.00% 647,762 647,762 201,135 201,135
packages/material-ui/build/umd/material-ui.production.min.js 0.00% 0.00% 301,958 301,958 83,730 83,730

Generated by 🚫 dangerJS against e6e251b

@oliviertassinari oliviertassinari force-pushed the remove-withMobileDialog branch 3 times, most recently from 382f483 to e6e251b Compare March 21, 2019 13:32
@eps1lon eps1lon mentioned this pull request Mar 21, 2019
56 tasks
@oliviertassinari oliviertassinari added this to the v4.1 milestone Mar 22, 2019
@oliviertassinari oliviertassinari added on hold There is a blocker, we need to wait and removed PR: good for merge labels Mar 22, 2019
@oliviertassinari oliviertassinari changed the base branch from next to master May 23, 2019 21:10
@oliviertassinari oliviertassinari changed the title [Dialog] Deprecate withMobileDialog [Dialog] Prepare deprecation of withMobileDialog Jun 21, 2019
@oliviertassinari oliviertassinari added docs Improvements or additions to the documentation and removed deprecation New deprecation message on hold There is a blocker, we need to wait labels Jun 21, 2019
@oliviertassinari oliviertassinari removed this from the v4.x milestone Jun 21, 2019
@mui-pr-bot
Copy link

No bundle size changes comparing 6957c91...b683999

Generated by 🚫 dangerJS against b683999

@RDIL RDIL mentioned this pull request Oct 22, 2020
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: dialog This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants