-
Notifications
You must be signed in to change notification settings - Fork 5
/
Label.js
69 lines (61 loc) · 1.32 KB
/
Label.js
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
import styled, { css } from "styled-components";
import { colors } from "@crave/farmblocks-theme";
const enabledStyles = props =>
(props.disabled &&
css`
.visibleInput {
color: ${colors.GREY_16};
background: currentColor;
}
`) ||
css`
cursor: pointer;
&:hover .visibleInput,
& .hiddenInput:focus + .visibleInput {
color: ${colors.INDIGO_MILK_CAP};
border-width: 2px;
}
`;
const checkedStyles = props =>
props.checked &&
css`
.checkedIndicator {
opacity: 1;
transform: scale(1);
}
`;
export default styled.label`
margin: 0;
display: inline-flex;
align-items: center;
.hiddenInput {
opacity: 0;
width: 0;
margin: 0;
}
.visibleInput {
height: 16px;
width: 16px;
color: ${colors.INDIGO_MILK_CAP};
border: 1px solid currentColor;
border-radius: 8px;
margin: 4px 8px;
display: inline-flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
}
.checkedIndicator {
height: 8px;
width: 8px;
border-radius: 4px;
background: currentColor;
opacity: 0;
transition: opacity 0.3s ease-out, transform 0.3s ease-out;
transform-origin: center;
transform: scale(0.2);
will-change: opacity, transform;
}
${enabledStyles};
${checkedStyles};
`;