You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reacted by Jaya Krishna Namburu, 0xeⲖ7, Anna Su, OPaquay, Marzena Malachowska, sanjeevbharti367466, Evgeny Kornak, Sercan, Amin Jafari, alpynv and 74 more
Reacted by David Vendel, Dima Tisnek, dinatahoun92, Bruna Santos, Ed Bentinck, medik, Tulsi Prasad, Ali RAFIQ, franklion, Hussam Khatib and 3 more
Reacted by David Vendel, Rudinei Silva, Dima Tisnek, dinatahoun92, Bruna Santos, Lewis Sherlock, Israel Akintunde, Bobby, Sune Øllgaard Klem, Luis Filipe Alves de Oliveira and 12 more
I like this as an underlying primitive and exposed API point, but same as with media queries – the user shouldn't have to be aware of the stuff we do to make their lives easier. Writing @keyframes into your string should just work, just like @media.
right? We're allowing nesting and @media and & to define extra classnames which feels good because it works just like Sass. But defining @keyframeswithin a definition doesn't really make any sense:
constStyledDiv=styled.div` animation: ${rotationBuilder(10)} 1s linear infinite;`
Which is totally awesome.
Reacted by Robert Kirsz, Quilt.bio, Pavlo Vozniuk, Dmytro Lebedynskyi, or frenkel, Nino, Ubayd, Kaspar Lyngsie, Victor Ricart, Braydie Grove and 31 more
Reacted by krisaoe, xmas11, Pavlo Vozniuk, Nino, Victor Ricart, James Tong, Gage Peterson, Damian Phillips-king, Dion Ridley, Emanuel Lorenzo and 2 more
I wanted to add the following for anyone that is, like I was, trying to find a way to make keyframes work with a styled component created via the object method.
Activity
geelen commentedon Sep 13, 2016
Hmm. How about:
mxstbr commentedon Sep 13, 2016
I like this as an underlying primitive and exposed API point, but same as with media queries – the user shouldn't have to be aware of the stuff we do to make their lives easier. Writing
@keyframesinto your string should just work, just like@media.geelen commentedon Sep 13, 2016
How do you attach the keyframes to the element though? Just have css-modules like name mangling?
Looks a bit awkward don't you think?
mxstbr commentedon Sep 13, 2016
Ah I forgot you have to define more than just
@keyframes, dang. Warming to your idea now!geelen commentedon Sep 21, 2016
So, my example above looks really bad to me, because it breaks the metaphor for
styled.tag:is the exact equivalent of this (this example could be useful in the docs in future)
right? We're allowing nesting and
@mediaand&to define extra classnames which feels good because it works just like Sass. But defining@keyframeswithin a definition doesn't really make any sense:That doesn't really make any sense. In Sass or in any PostCSS or anything, keyframes are always global.
I'm thinking we should instead do this:
Then we can also do something like
styled.globalfor injecting global styles, since we wanted to have that capability as well, right?haikyuu commentedon Dec 1, 2016
Bonus point, you can use
Which is totally awesome.
Swap out motivation section for Max's talk in Amsterdam
ljsherlock commentedon Jan 3, 2020
I wanted to add the following for anyone that is, like I was, trying to find a way to make keyframes work with a styled component created via the object method.