-
Notifications
You must be signed in to change notification settings - Fork 9
/
Indicator.styles.js
87 lines (72 loc) 路 1.92 KB
/
Indicator.styles.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import { css } from "styled-components";
import tokens from "@paprika/tokens";
import stylers from "@paprika/stylers";
const indicatorSize = stylers.spacer(3);
const topPadding = tokens.space;
const activeDotSize = tokens.space;
const lineStyles = css`
${stylers.z(1)}
border-left: 2px solid ${tokens.border.color};
content: "";
height: calc(100% - ${indicatorSize} + ${topPadding});
left: 50%;
position: absolute;
top: ${indicatorSize};
transform: translateX(-50%);
`;
const activeLineStyles = css`
${lineStyles}
${stylers.z(2)}
border-color: ${tokens.color.blue};
height: calc((100% - ${indicatorSize} + ${topPadding}) / 2);
`;
const activeStyles = css`
border-color: ${tokens.color.blue};
&:before {
background: ${tokens.color.blue};
border-radius: 100%;
content: "";
height: ${activeDotSize};
left: 50%;
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
width: ${activeDotSize};
}
`;
const doneStyles = css`
background-color: ${tokens.color.black};
border-color: ${tokens.color.black};
color: ${tokens.color.white};
`;
export const indicatorStyles = css`
&,
* {
box-sizing: border-box;
}
display: inline-block;
line-height: 1;
position: relative;
&:before {
${({ isLast }) => !isLast && lineStyles}
${({ isComplete }) => isComplete && `border-color: ${tokens.color.black}`}
}
&:after {
${({ isActive, isLast }) => isActive && !isLast && activeLineStyles}
}
`;
export const indicatorDotStyles = css`
${stylers.fontSize()}
${stylers.z(2)}
align-items: center;
background-color: ${tokens.color.white};
border: 2px solid ${tokens.color.blackLighten40};
border-radius: 100%;
display: flex;
height: ${indicatorSize};
justify-content: center;
position: relative;
width: ${indicatorSize};
${({ isActive, isComplete }) => isComplete && !isActive && doneStyles}
${({ isActive }) => isActive && activeStyles}
`;