Skip to content

Commit b6b8a12

Browse files
authored
Merge pull request danskernesdigitalebibliotek#124 from itk-dev/feature/favorite-btn-green-when-filled
Green favorite heart when filled
2 parents 6fbce87 + 98132c3 commit b6b8a12

File tree

4 files changed

+20
-17
lines changed

4 files changed

+20
-17
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 ? "#000" : "none"}
14-
xmlns="http://www.w3.org/2000/svg"
15-
>
16-
<path
17-
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"
18-
stroke="black"
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

src/stories/Library/colors/color-variables.scss

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ $c-signal-alert: #d5364a;
2424
--identity-color-h: 145;
2525
--identity-color-s: 22%;
2626
--identity-color-l: 35%;
27-
--identity-color: var(--identity-color-h), var(--identity-color-s),
28-
var(--identity-color-l);
27+
--identity-color: hsl(
28+
var(--identity-color-h),
29+
var(--identity-color-s),
30+
var(--identity-color-l)
31+
);
2932
--tint-color-20: hsl(var(--identity-color), 0.2);
3033
--tint-color-40: hsl(var(--identity-color), 0.4);
3134
--tint-color-60: hsl(var(--identity-color), 0.6);

0 commit comments

Comments
 (0)