Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Feat: Add Mobile styles to FooterNav #181
Feat: Add Mobile styles to FooterNav #181
Changes from 2 commits
a22f434
c10f495
a299f35
593e90a
7a9df0a
4389a6d
14e7c34
18800b0
b25d3bd
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 can't figure out how to test window resize with running into typescript
read-only
limitations on reassigningwindow
objects during a test. Ideally, I was going to use jestbeforeAll
to adjust the window size to mobile before running all the tests in this describe block.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 use the
resizeTo
method instead of reassigning the dimensions? https://developer.mozilla.org/en-US/docs/Web/API/Window/resizeToimo this would be a great test to have!
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.
Tried out
resizeTo
but its not implemented. jest incorporates JSDOM to overridewindow
- and JSDOM doesn't support all the same methods. Ended up overriding tyepscript and then eslint warnings about overriding typescript 😆 I hadn't realized I could just do that and move on.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.
This is super minor but I noticed there is a brief flash of the desktop nav at mobile sizes on render. I think that could be resolved by doing the initial window size check here to default the state to the correct value (instead of
false
) and then that would remove the need to triggerhandleResize()
in the effect hookThere 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.
non-blocking: just for performance, couldn't we also do an early
return
ifisMobile
is defined? since then the fallback isn't used at all and we wouldn't need to attach the event listener.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.
my only suggestion here would be to only call
setIsMobile
if the value has changed, to avoid extraneous state updates