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

Animation won't run using JSX inline styles #785

Closed
mallendeo opened this issue Jan 16, 2017 · 5 comments
Closed

Animation won't run using JSX inline styles #785

mallendeo opened this issue Jan 16, 2017 · 5 comments
Labels
Upstream Related to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.).

Comments

@mallendeo
Copy link

mallendeo commented Jan 16, 2017

screen shot 2017-01-15 at 11 32 41 pm

The animation won't run since a css selector/property can't start with a number.

@mallendeo mallendeo changed the title Animation won't run with JSX inline styles Animation won't run using JSX inline styles Jan 16, 2017
@nkzawa nkzawa added Upstream Related to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.). Type: Bug labels Jan 16, 2017
@nkzawa
Copy link
Contributor

nkzawa commented Jan 16, 2017

What version of next.js do you use ? It looks styled-jsx is already fixed vercel/styled-jsx@5377347 and vercel/styled-jsx@1605947

@mallendeo
Copy link
Author

@nkzawa Just upgraded to 2.0.0-beta.17
After the upgrade, this is the output:
screen shot 2017-01-16 at 9 55 12 am

Note that forwards also gets prefixed.

LoadingIndicator.js

export default ({ active }) =>
  <div className={`loadingIndicator ${active ? 'active' : ''}`}>
    {
      [
        '#80DEEA',
        '#26C6DA',
        '#00ACC1',
        '#00838F',
        '#006064'
      ].map((color, i) =>
        <div
          style={{ backgroundColor: color, animationDelay: `-${1 - i / 20}s` }}
          key={`stripe${i}`}
          className='stripe'
        />
      )
    }
    <style jsx>{`
      .loadingIndicator,
      .stripe {
        left: 0;
        bottom: 0;
        width: 100%;
        position: absolute;
      }
      .loadingIndicator {
        color: #333;
        height: .2rem;
        opacity: 0;
        transition: opacity 1s 1s ease;
      }
      .stripe {
        height: 100%;
        animation: loading 1s ease infinite forwards;
      }
      .loadingIndicator.active {
        opacity: 1;
        transition-delay: 0s;
      }
      .loadingIndicator.active .stripe {
        animation: loading 1s ease infinite forwards;
      }
      @keyframes loading {
        0% {
          transform: scaleX(0);
          opacity: 1;
        }
        80% {
          transform: scaleX(100%);
        }
        100% {
          opacity: 0;
        }
      }
    `}</style>
  </div>

@nkzawa
Copy link
Contributor

nkzawa commented Jan 16, 2017

@mallendeo thanks for your feedback. I created the issue vercel/styled-jsx#77.
I think you can define animations using non-shorthand properties like animation-name instead of animation for now.

@mallendeo
Copy link
Author

@nkzawa Thanks!

@timneutkens
Copy link
Member

This will be fixed in the next beta release.

@lock lock bot locked as resolved and limited conversation to collaborators May 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Upstream Related to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.).
Projects
None yet
Development

No branches or pull requests

3 participants