-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproduct-color.scss
81 lines (74 loc) · 1.59 KB
/
product-color.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
@import 'common';
.product-color {
display: inline-block;
position: relative;
user-select: none;
height: remsize(24);
margin: map-get($spacers, 12);
&-label {
input:focus + & {
@include input-focus();
}
@include tap-area-selector();
position: relative;
text-indent: 100%;
white-space: nowrap;
height: remsize(24);
width: remsize(24);
border-radius: 50%;
background-color: $gray;
border: 1px solid $black-25;
cursor: pointer;
&:after {
content: '';
position: absolute;
opacity: 0;
left: remsize(5);
top: remsize(5);
border-left: 1px solid $deep-black;
border-bottom: 1px solid $deep-black;
transform: rotate(-45deg);
width: remsize(14);
height: remsize(8);
}
@include media-breakpoint-up(lg) {
&:before {
width: 32px;
}
}
}
input {
position: absolute;
opacity: 0;
height: 0;
width: 0;
&:checked ~ .product-color-label {
background-color: $gray;
}
&:checked ~ .product-color-label:after {
opacity: 1;
}
}
@include media-breakpoint-up(lg) {
margin: map-get($spacers, 4) map-get($spacers, 8);
}
@each $name, $value in $product-colors {
&.#{$name} {
.product-color-label {
background-color: $value;
}
&:hover input ~ .product-color-label,
&:hover input:checked ~ .product-color-label {
background-color: darken($value, 10);
}
input:checked ~ .product-color-label {
background-color: $value;
}
}
}
}
.product-color.black .product-color-label::after,
.product-color.violet .product-color-label::after,
.product-color.navy-blue .product-color-label::after {
border-color: $white;
}