Skip to content

Commit 98132c3

Browse files
committed
5410: Use css to control color
1 parent d97c202 commit 98132c3

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed
Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
1+
import { ReactComponent as SvgIcon } from "./icon-favourite.svg";
2+
13
export type IconFavouriteProps = {
24
fill?: boolean;
35
};
46

57
export const IconFavourite = ({ fill }: IconFavouriteProps) => {
6-
// This svg is a copy from public/icons/basic/icon-heart.svg.
7-
// If you find out it no longer matches the original file, please update it
8-
// It is made as inline svg to be able to change fill value from props
98
return (
10-
<svg
11-
className="icon-favourite"
12-
viewBox="0 0 24 24"
13-
fill={fill ? "var(--identity-color)" : "none"}
14-
stroke={fill ? "var(--identity-color)" : "black"}
15-
xmlns="http://www.w3.org/2000/svg"
16-
>
17-
<path
18-
d="M11.5 20L10.2675 18.921C5.89 15.1035 3 12.5858 3 9.49591C3 6.9782 5.057 5 7.675 5C9.154 5 10.5735 5.66213 11.5 6.70845C12.4265 5.66213 13.846 5 15.325 5C17.943 5 20 6.9782 20 9.49591C20 12.5858 17.11 15.1035 12.7325 18.9292L11.5 20Z"
19-
strokeWidth="2"
20-
/>
21-
</svg>
9+
<SvgIcon
10+
className={
11+
fill ? "icon-favourite icon-favourite--filled" : "icon-favourite"
12+
}
13+
/>
2214
);
2315
};

src/stories/Library/Icons/icon-favourite/icon-favourite.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@
22
cursor: pointer;
33
height: 24px;
44
width: 24px;
5+
6+
&--filled {
7+
color: var(--identity-color);
8+
fill: var(--identity-color);
9+
}
510
}
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)