Open
Conversation
8221f9b to
eae2c13
Compare
robesonck
commented
Dec 26, 2021
|
|
||
| &:hover { | ||
| border-width: 2px; | ||
| padding: $vertical-padding - 1 $horizontal-padding - 1; |
Owner
Author
There was a problem hiding this comment.
Note for reviewers:
Removing 1 since it's the difference in border-width compared with the normal state. Same happens with the active state.
robesonck
commented
Dec 26, 2021
| if (loading) { | ||
| addNormalAnimation(stopMilliseconds); | ||
| } | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps |
Owner
Author
There was a problem hiding this comment.
Note for reviewers:
Here we are disabling the dependencies because addNormalAnimation and stopMilliseconds change often, making this effect be called many times, so it's easier in the case to just pass one dependency
robesonck
commented
Dec 26, 2021
| return Math.round((passedTime / totalTime) * 100); | ||
| }; | ||
|
|
||
| function reducer(state, action) { |
Owner
Author
There was a problem hiding this comment.
Note for reviewers:
Even if useReducer can feel more complex at times, I noticed that in this case we need to update many pieces of state at once and that's easier with a reducer than with useState
eae2c13 to
c9a41a5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This request solves the Progress Bar Exercise .
To do that, some setup changes were needed:
Buttonand aProgressBarcomponentsuseProgressBarStatethat has a reducer inside. This allows to use complex logic, while keeping theProgressBarminimal.Recording
Screen.Recording.2021-12-25.at.18.38.35.mov
This recording shows how when starting the fake API request, the bar starts animating . After that, if we finish the request the bar animates until the end in one second and fades out in 3.
After that first demo, we can see in the recording how if we follow the same process, but don't let the bar finish fading it just starts again from the beginning without a problem
Assumptions