theme in keyframes #4036
Unanswered
maxime4000
asked this question in
Q&A
Replies: 1 comment
-
You can create a separate function to set the animation. The function will receive the props of the styled component from which the function will access the direction prop. const setSkeletonAnimation = (theme) => {
const animation = keyframes`
0% {
background-color: ${theme.blue};
}
100% {
background-color: ${theme.red};
}
`;
return css`
animation: ${animation} 1s linear infinite alternate;
`;
};
const Div = styled.div`
${({ theme }) => setSkeletonAnimation(theme)};
`; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So we have a TS Styled component app with working theme. Writing this would work :
I want to animate a background-color for a "skeleton" component. So I'm expecting this to work, but theme doesn't work...
I tried this below, but it doesn't work at all...
There is no documentation on this so maybe I don't know how to do this, but it seem like a no brainer that this should work.
Using version : 5.3.11
Also curious, should I do something like this for adding typing support ?
Beta Was this translation helpful? Give feedback.
All reactions