Having a problem I can’t solve. Searched online but cant see an answer that helps. I may be lacking basic knowledge…
The problem: a parent component has a hover state. Upon hover, I would like an instance of another component within the parent component to change.
The instance contains text. So when the parent component is in it default state, the instance placed within it says one thing.
Upon hovering on the parent component, the instance within it moves position and its color and text changes.
Everything works as expected except for the text change.
Tried making separate components for the instance (one for the parent default and one for the parent hover) but smart animate doesn’t work then.
What you want to do can be achieved in several ways:
Use separate components for your badges.
Insert both badges in each card variant and control the visibility of these badges based on the state of the card.
Use variants of the same component.
If your badge component has several variants, then you need to add another text layer to each variant and control the visibility of the text layer, depending on the badge variant.
I tried it a different way and it works…
Have all badges as variants in one component only.
In the main component where the badges will be seen. Place variants of the badge in the positions needed.
Smart animate will then change between the variants (upon hover in this case).
The text, color and position of the badges are now animating seamlessly.