Skip to content
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

Fix for opaque keyframes as object values #1414

Merged
merged 1 commit into from
Jun 26, 2019

Conversation

Andarist
Copy link
Member

fixes #1259

Let's discuss the fix first, going to add changeset later.

@changeset-bot
Copy link

changeset-bot bot commented Jun 25, 2019

💥 No Changeset

Latest commit: e45ae4e

Merging this PR will not cause any packages to be released. If these changes should not cause updates to packages in this repo, this is fine 🙂

If these changes should be published to npm, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

)
}
},
'object with animationName and string keyframes as value': {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a test covering previously uncovered (but working) situation

@@ -32,7 +32,7 @@ let processStyleValue = (
case 'animation':
case 'animationName': {
if (typeof value === 'string') {
value = value.replace(animationRegex, (match, p1, p2) => {
return value.replace(animationRegex, (match, p1, p2) => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a short circuit

@codecov
Copy link

codecov bot commented Jun 25, 2019

Codecov Report

Merging #1414 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted Files Coverage Δ
packages/serialize/src/index.js 100% <100%> (ø) ⬆️

@Andarist Andarist force-pushed the fix/interpolated-opaque-keyframes branch from 6de7aec to d846ede Compare June 25, 2019 07:59
)}}`
)
switch (key) {
case 'animation':
Copy link
Member

@emmatown emmatown Jun 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case will never happen and because of that, let's change this to an if (key === 'animationName') else

return (
<div
css={{
animation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't do anything, you need to at least also specify the duration of the animation. (hence the previous comment)

Copy link
Member Author

@Andarist Andarist Jun 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add animationDuration here to reflect better real-world scenario (EDIT: done), but unfortunately animation can contain just an animation name and it's a valid CSS:
https://codesandbox.io/s/sad-cookies-oj0wk

@Andarist Andarist force-pushed the fix/interpolated-opaque-keyframes branch from d846ede to e45ae4e Compare June 26, 2019 07:19
Copy link
Member

@emmatown emmatown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

object style css not working with animations
2 participants