@@ -22,30 +22,104 @@ footer {
22
22
}
23
23
24
24
#counter {
25
- margin : 1em 0 ;
25
+ font-family : $font-family-monospace ;
26
+ font-size : 28px ;
27
+ line-height : 1 ;
26
28
27
- span .digit {
28
- background-color : $black ;
29
- font-family : monospace ;
30
- font-size : 28px ;
31
- font-style : italic ;
29
+ text-align : left ;
30
+
31
+ margin : 1rem 0 ;
32
+
33
+ div .digits {
34
+ display : flex ;
35
+ flex-direction : row ;
36
+ }
37
+
38
+ div .digit {
39
+ $digit-numeral-height : 1em ;
40
+ $digit-vertical-padding : 0.5rem ;
41
+ $digit-border-size : 2px ;
32
42
33
- border : 2px solid $gray-700 ;
43
+ background-color : $black ;
44
+ border : $digit-border-size solid $gray-800 ;
34
45
border-radius : 7px ;
35
46
36
47
position : relative ;
37
48
38
- padding : 0.25em ;
39
- padding-right : 0.35em ;
40
- margin-right : 1px ;
49
+ padding : $digit-vertical-padding 0.4rem ;
50
+
51
+ margin-right : 1px ; // to separate the digits.
52
+
53
+ // prettier-ignore
54
+ height : calc (
55
+ #{$digit-numeral-height } +
56
+ (#{$digit-vertical-padding } * 2 ) +
57
+ (#{$digit-border-size } * 2 )
58
+ );
59
+ width : calc (
60
+ 5px + 1em
61
+ ); // approximately the width of one monospace character.
62
+
63
+ $flip-opacity : 0.3 ;
64
+ $flip-speed : 0.05s ;
65
+ $flip-distance : 10px ;
66
+
67
+ span .current {
68
+ animation : none ;
69
+ }
70
+
71
+ span .previous {
72
+ animation : slideAway ($flip-speed / 2 );
73
+ }
74
+
75
+ span .next {
76
+ animation : slideInto ($flip-speed / 2 );
77
+ }
78
+
79
+ span .previous ,
80
+ span .next {
81
+ position : absolute ;
82
+ }
83
+
84
+ & .mutating span {
85
+ opacity : $flip-opacity ;
86
+ }
87
+
88
+ @keyframes slideAway {
89
+ 0% {
90
+ opacity : $flip-opacity ;
91
+ bottom : 0 ;
92
+ }
93
+
94
+ 100% {
95
+ opacity : 0 ;
96
+ bottom : $flip-distance ;
97
+ }
98
+ }
99
+
100
+ @keyframes slideInto {
101
+ 0% {
102
+ opacity : 0 ;
103
+ top : $flip-distance ;
104
+ }
105
+
106
+ 100% {
107
+ opacity : $flip-opacity ;
108
+ top : 0 ;
109
+ }
110
+ }
41
111
}
42
112
43
- span .digit ::before {
44
- content : " " ;
113
+ // This renders the little border line in the center of the digit.
114
+ div .digit ::before {
115
+ content : " " ; // must be present for this to render.
116
+
45
117
position : absolute ;
46
- z-index : 0 ;
47
118
bottom : 50% ;
48
119
left : 0 ;
120
+
121
+ z-index : 0 ;
122
+
49
123
border-bottom : 2px solid rgba ($gray-600 , 50% );
50
124
width : 100% ;
51
125
}
0 commit comments