-
Notifications
You must be signed in to change notification settings - Fork 14
Turn off syncAnimationRestarts for chromatic and buttons #141
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.
I can't think of a better way to solve this 🤷♂ ; left one question. Answer and I'll re-review 😃
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 failing CI. Please take a look and toss it back for review
You also forgot to add a label. |
e097c2e
to
fb390f7
Compare
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.
Thanks for this @jgzuke ! I left one minor
to add a comment, then merge away!
src/Loaders/LoadingSpinner.tsx
Outdated
} | ||
|
||
export const LoadingSpinner: React.FC<Props> = ({ | ||
theme = "light", | ||
size = "medium", | ||
syncAnimationRestarts = true, |
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.
minor: I'm sorry I keep doing this, but please add a jsdoc comment explaining what this does so we can see that from AGM. After that, merge away!
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 going to cause issues for Chromatic tests in libraries consuming this package. I'm struggling to think of a solid solution to make this safe for consuming libraries while also not including chromatic in the tests. I am also running into the same issue for disabling animations in Modals.
Here's a hacky thought: what if we added a static property to the component itself that would disable the animation? That way we can do something like LoadingSpinner.animationSync = false
in the storybook/chromatic setup and then all loaders would behave as we expect for visual testing.
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 going to cause issues for Chromatic tests in libraries consuming this package. I'm struggling to think of a solid solution to make this safe for consuming libraries while also not including chromatic in the tests. I am also running into the same issue for disabling animations in Modals.
Here's a hacky thought: what if we added a static property to the component itself that would disable the animation? That way we can do something like LoadingSpinner.animationSync = false in the storybook/chromatic setup and then all loaders would behave as we expect for visual testing.
35285be
to
6386654
Compare
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.
Thanks for working through this with me @jgzuke !
🚀 PR was released in v2.19.0 🚀 |
Add
syncAnimationRestarts
(default true) prop toLoadingSpinner
to replace usage ofisChromatic
. Also set to false in stories and buttons. We only really need it false in stories but this seemed easier than passing thesyncAnimationRestarts
prop to buttons as well, it also seemed like it would look more natural if button loaders weren't synced.Im a bit conflicted about whether this should default to false instead. I feel like the default makes more sense to be false since we only really want this for our full page loaders, however it seems likely for people to miss setting the prop. This is mitigated a bit if we only use the engine wrappers instead of this component directly.