This repository was archived by the owner on Jan 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
AP-1222 Add option to disable Modal animations #142
Merged
justinanastos
merged 4 commits into
master
from
justin/AP-1222/disable-modal-animations
Nov 21, 2019
Merged
AP-1222 Add option to disable Modal animations #142
justinanastos
merged 4 commits into
master
from
justin/AP-1222/disable-modal-animations
Nov 21, 2019
Conversation
This file contains 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
dbb035f
to
091ebb1
Compare
cheapsteak
approved these changes
Nov 21, 2019
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.
Love the considerate ergonomics!
What do you think about package-wide setting? Would be convenient if we could set this once, either via something like
spaceKitSettings.disableAnimations = true;
// similar to _.templateSettings
or
<SpaceKitProvider disableAnimations={true}>
...
</SpaceKitProvider>
@cheapsteak I love
Those are great ideas! Let me take a look at how quickly I can create |
091ebb1
to
c988123
Compare
c988123
to
c5a12f7
Compare
cheapsteak
approved these changes
Nov 21, 2019
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.
very nice!
c5a12f7
to
dbefab7
Compare
dbefab7
to
a5f5180
Compare
🚀 PR was released in v2.18.0 🚀 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Contributes to issue https://apollographql.atlassian.net/browse/AP-1222
The context implementation is inspired by Kent C. Dodds's "Using Context Effectively" blog post. I suggest you read it!
Problem
We use framer motion to animate our
Modal
component. This looks awesome! Unfortunately, Chromatic can't automatically disable JavaScript based animations (see the docs https://docs.chromaticqa.com/animations); this can lead to Chromatic snapshots being taken mid-animation, causing unacceptable flake in our visual tests. Even worse, this behavior is non-deterministic, so if we take a snapshot onmaster
and that snapshot is taken mid-animation, that change will be auto-accepted and that will become the new baseline. See this example: https://www.chromaticqa.com/snapshot?appId=5a77a6d38a9e3c002045d20d&id=5dd5a7093b1d9300209972b2Solution
Per @cheapsteak 's suggestion, create an optional
SpaceKitProvider
that accepts props to disable animations across all space kit components. We can wrap our application with this or use it as a Storybook decorator to wrap it around all our stories.This will prevent us from having to add
isChromatic
to our exported components (great catch on this @trevorblades !), and will prevent us from having to remember to conditionally disable animations in our stories or components if we're rendering inside Chromatic.I've tested this in AGM; it works as expected 😃