-
Notifications
You must be signed in to change notification settings - Fork 3
Migrate useMediaQuery hooks #1563
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
Conversation
ChristopherChudzicki
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you undo this change to Testimonials page? To avoid conflicts with #1568
ChristopherChudzicki
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also see two usages of useMuiBreakpointAtLeast remaining:
- frontends/ol-components/src/components/LearningResourceCard/LearningResourceListCardCondensed.tsx
- frontends/ol-components/src/hooks/useBreakpoint.ts
Additionally, it might be good to add
{
name: "@mui/material/useMediaQuery",
message: "Use CSS instead; with SSR, useMediaQuery can cause an initially different styling. ",
},
to the @typescript-eslint/no-restricted-imports rule in eslintrc
Urrg sorry, this branch was missing a cherry pick after rebase / cleanup. Let's revisit our approach of rebasing main onto the |
070e230 to
98d37de
Compare
317b871 to
c2a1c54
Compare
98d37de to
9bab4f4
Compare
c2a1c54 to
1e6be01
Compare
* Whitelist all image URLs * Replace media query hook with CSS only * Update news and events * Fixes homepage text styles * Breakpoint at md * Update condensed resource card. Remove use breakpoint. * Update tests for homepage desktop and mobile headings both present
* Whitelist all image URLs * Replace media query hook with CSS only * Update news and events * Fixes homepage text styles * Breakpoint at md * Update condensed resource card. Remove use breakpoint. * Update tests for homepage desktop and mobile headings both present
* Whitelist all image URLs * Replace media query hook with CSS only * Update news and events * Fixes homepage text styles * Breakpoint at md * Update condensed resource card. Remove use breakpoint. * Update tests for homepage desktop and mobile headings both present
What are the relevant tickets?
Fixes https://github.com/mitodl/hq/issues/5471
Description (What does it do?)
Replaces all uses of
useMuiBreakpointAtLeast()with css-only media queries. The reason is that the hook uses window.matchMedia(), which is not availalbe in the server for server rendered content.Also fixes css issues with the headings in the homepage Testimonials and News / Events that I noticed (present in RC and Prod).
Whitelists all image URLs in the config.
Screenshots (if appropriate):
How can this be tested?
Load the homepage.
Load the search page
Additional Context