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

how to use css helpers from styled-components? #8656

Closed
bogdanq opened this issue Oct 31, 2019 · 5 comments
Closed

how to use css helpers from styled-components? #8656

bogdanq opened this issue Oct 31, 2019 · 5 comments

Comments

@bogdanq
Copy link

bogdanq commented Oct 31, 2019

error - It seems you are interpolating a keyframe declaration (krDXiq) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css`` helper which ensures the styles are injected correctly

const style = {
  rollin: css`
    animation-name: ${({ isAnimated }) => (isAnimated ? rollinIn : scaleOut)};
  `,
  zoom: css`
    animation-name: ${({ isAnimated }) => (isAnimated ? zoomIn : scaleOut)};
  `,
};

 <SomeComponent style={style[name]} />
@shilman
Copy link
Member

shilman commented Oct 31, 2019

See here? #7540

@stale
Copy link

stale bot commented Nov 21, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Nov 21, 2019
@bogdanq
Copy link
Author

bogdanq commented Nov 29, 2019

#7540 this option does not work. A problem with keyframes in storybook.
If you do everything in the ModalForCustomAnimate component, there will be no error,

const zoomIn = keyframes`
  from {
    opacity: 0;
    transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0);
    animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
  }
  60% {
    opacity: 1;
    transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0);
    animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);
  }

const animationCustomStyle = {
  zoom: css`
    border: 1px solid red;
    animation-name: ${({ isAnimated }) =>
      isAnimated ? rollinIn : scaleOut};
  `,
}

const scaleOut = keyframes`
  0% {
    opacity: 1;
    transform: scale(1)
  }
  100% {
    opacity: 0.5;
    transform: scale(0.5)
  }
`
const rollinIn = keyframes`
  from {
    opacity: 0;
    transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }

const ModalForCustomAnimate = ({ customAnimationName, ...props }) => {
  return (
    <>
      <Modal
        /*here is a mistake*/
        customAnimation={animationCustomStyle[customAnimationName]}
        {...props}
      >
        {({ closeModal }) => (
          <div>
            <h1>Modal with custom animation</h1>
            <button onClick={closeModal}>Close</button>
          </div>
        )}
      </Modal>
    </>
  )
}

key

link for Modal component

link fot styled modal wrapper

@stale stale bot removed the inactive label Nov 29, 2019
@stale
Copy link

stale bot commented Dec 20, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Dec 20, 2019
@stale
Copy link

stale bot commented Jan 19, 2020

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

@stale stale bot closed this as completed Jan 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants