-
Notifications
You must be signed in to change notification settings - Fork 54
Conversation
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.
LGTM 👍
mediaQueryList.addListener(event => { | ||
setIsScrollable(event.matches); | ||
}); |
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.
With this refactor we don't have the removeListener
method anymore.
const handler = event => setMatches(event.matches);
mediaQueryList.addListener(handler);
return () => mediaQueryList.removeListener(handler);
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.
Good point, I'll add this back in for the story to prevent the storybook slowing down due to there being a load of extra listeners that aren't being used anymore.
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.
LGTM
Resolves #NUMBER
Overall change: Remove the media query hook so that it can be added in simorgh to allow for other actions to be triggered on a media query.
Code changes:
isScrollable
prop to be set in Simorgh based on the media query hook