- My stack includes nextjs13, chakra-ui, and vanilla-extract
Seeking guidance on how to update both icon and text within a button upon hover, utilizing chakra-ui and vanilla-extract.
The current setup of my button is as follows:
<Button >
<svg width="16" height="18">
<use xlinkHref={path/to/iconA}></use>
</svg>
{!isFollowing ? <span>follow</span> : <span>following</span>}
</Button>
I aim to display the 'follow' button with icon A if the logged-in user is not following the individual.
Likewise, I want to showcase "following" with icon A if the logged-in user already follows the individual.
When hovering over the button (and the current user follows the individual), I desire a transition in the button's text: from "following" to "unfollow" with red text color, as well as an alteration in the icon from iconA to iconB.
I managed to adjust the text color by applying CSS to span:
<span className={textCss}>following</span>
const textCss = style({
"":hover":{
color:"red"
}})
However, I am unsure of how to modify both the text and the icon simultaneously.