0
import { FaRegHeart } from 'react-icons/fa';


const IconHeart = styled(FaRegHeart)`

width:21px;
height:18px;
position: absolute;
left: 28%;
top:30%;
cursor: pointer;
&:hover{
 background-color:red;
}
`


function Heart() {
  return (
    <HeartBox>

      <IconHeart />

    </HeartBox>

  )
}

Guestion:

I what full contorl over the svg icon, hover do not work on this icon. LIke to heart have border around icons, but if i set border he put put border around icon not on inon itsef

Sava
  • 113
  • 1
  • 13

1 Answers1

3

You need to use the fill properties of SVG

const IconHeart = styled(FaRegHeart)`
  width:21px;
  height:18px;
  position: absolute;
  left: 28%;
  top:30%;
  cursor: pointer;

  :hover{
    fill:red;
    }
`

Codesandbox example :
https://codesandbox.io/s/styled-hover-fill-svg-iks37

drub4n
  • 148
  • 8