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

[RFR] Convert AppBar to use useDispatch, useSelector, useWidth #3595

Merged
merged 3 commits into from
Aug 26, 2019

Conversation

jaytula
Copy link
Contributor

@jaytula jaytula commented Aug 23, 2019

Convert AppBar to use useDispatch, useSelector, useWidth.

The useWidth was taken from material-ui documentation example: https://material-ui.com/components/use-media-query/#migrating-from-withwidth

Maybe useWidth should be defined in ra-core/src whereby it can be exported for other components that need it.

Done by request in #3582

Copy link
Contributor

@djhi djhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that, you should use the useMediaQuery hook:

const isXSmall = useMediaQuery(theme => theme.breakpoints.down('xs'));

And then:

variant={isXSmall ? 'regular' : 'dense'}

Copy link
Contributor

@djhi djhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks :)

@djhi djhi added this to the 3.0.0 milestone Aug 26, 2019
@djhi djhi merged commit 2bfb7e3 into marmelab:next Aug 26, 2019
@jaytula jaytula deleted the appbar-usedispatch-useselector branch August 28, 2019 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants