|
1 | 1 | @use '../abstracts/breakpoints' as bp; |
2 | | -@use '../abstracts/placeholders'; |
3 | 2 |
|
4 | | -#archives { |
5 | | - letter-spacing: 0.03rem; |
6 | | - |
7 | | - @include bp.lt(bp.get(sm)) { |
8 | | - margin-top: -1rem; |
9 | | - |
10 | | - ul { |
11 | | - letter-spacing: 0; |
12 | | - } |
13 | | - } |
| 3 | +$tl-offset: 1.75rem; |
| 4 | +$tl-line-w: 2px; |
| 5 | +$tl-year-dot: 10px; |
| 6 | +$tl-post-dot: 6px; |
14 | 7 |
|
15 | | - $timeline-width: 4px; |
| 8 | +#archives { |
| 9 | + --tl-line: var(--timeline-color); |
| 10 | + --tl-node: var(--timeline-node-bg); |
| 11 | + --tl-dot: var(--timeline-year-dot-color, var(--main-bg)); |
16 | 12 |
|
17 | | - %timeline { |
18 | | - content: ''; |
19 | | - width: $timeline-width; |
20 | | - position: relative; |
21 | | - float: left; |
22 | | - background-color: var(--timeline-color); |
23 | | - } |
| 13 | + border-left: $tl-line-w solid var(--tl-line); |
| 14 | + margin-left: calc(#{$tl-year-dot} / 2); |
| 15 | + padding-left: $tl-offset; |
24 | 16 |
|
25 | 17 | .year { |
26 | | - height: 3.5rem; |
27 | | - font-size: 1.5rem; |
28 | 18 | position: relative; |
29 | | - left: 2px; |
30 | | - margin-left: -$timeline-width; |
31 | | - |
32 | | - &::before { |
33 | | - @extend %timeline; |
34 | | - |
35 | | - height: 72px; |
36 | | - left: 79px; |
37 | | - bottom: 16px; |
38 | | - } |
39 | | - |
40 | | - &:first-child::before { |
41 | | - @extend %timeline; |
42 | | - |
43 | | - height: 32px; |
44 | | - top: 24px; |
| 19 | + font-size: 1.35rem; |
| 20 | + font-weight: 700; |
| 21 | + color: var(--heading-color); |
| 22 | + margin: 1.5rem 0 0.5rem; |
| 23 | + display: block; |
| 24 | + |
| 25 | + &:first-child { |
| 26 | + margin-top: 0; |
45 | 27 | } |
46 | 28 |
|
47 | | - /* Year dot */ |
48 | | - &::after { |
| 29 | + &::before { |
49 | 30 | content: ''; |
50 | | - display: inline-block; |
51 | | - position: relative; |
| 31 | + position: absolute; |
| 32 | + left: calc(-#{$tl-offset} - #{$tl-line-w} / 2); |
| 33 | + top: 50%; |
| 34 | + transform: translate(-50%, -50%); |
| 35 | + width: $tl-year-dot; |
| 36 | + height: $tl-year-dot; |
52 | 37 | border-radius: 50%; |
53 | | - width: 12px; |
54 | | - height: 12px; |
55 | | - left: 21.5px; |
56 | | - border: 3px solid; |
57 | | - background-color: var(--timeline-year-dot-color); |
58 | | - border-color: var(--timeline-node-bg); |
59 | | - box-shadow: 0 0 2px 0 #c2c6cc; |
60 | | - z-index: 1; |
| 38 | + background: var(--tl-dot); |
| 39 | + border: $tl-line-w solid var(--tl-node); |
61 | 40 | } |
62 | 41 | } |
63 | 42 |
|
64 | 43 | ul { |
65 | | - li { |
66 | | - font-size: 1.1rem; |
67 | | - line-height: 3rem; |
68 | | - |
69 | | - @extend %text-ellipsis; |
70 | | - |
71 | | - &:nth-child(odd) { |
72 | | - background-color: var(--main-bg, #ffffff); |
73 | | - background-image: linear-gradient( |
74 | | - to left, |
75 | | - #ffffff, |
76 | | - #fbfbfb, |
77 | | - #fbfbfb, |
78 | | - #fbfbfb, |
79 | | - #ffffff |
80 | | - ); |
81 | | - } |
82 | | - |
83 | | - &::before { |
84 | | - @extend %timeline; |
| 44 | + list-style: none; |
| 45 | + padding: 0; |
| 46 | + margin: 0; |
| 47 | + } |
85 | 48 |
|
86 | | - top: 0; |
87 | | - left: 77px; |
88 | | - height: 3.1rem; |
89 | | - } |
90 | | - } |
| 49 | + li { |
| 50 | + position: relative; |
| 51 | + padding: 0.4rem 0; |
| 52 | + line-height: 1.6; |
| 53 | + display: flex; |
| 54 | + align-items: baseline; |
| 55 | + gap: 0.75rem; |
91 | 56 |
|
92 | | - &:last-child li:last-child::before { |
93 | | - height: 1.5rem; |
| 57 | + &::before { |
| 58 | + content: ''; |
| 59 | + position: absolute; |
| 60 | + left: calc(-#{$tl-offset} - #{$tl-line-w} / 2); |
| 61 | + top: 50%; |
| 62 | + transform: translate(-50%, -50%); |
| 63 | + width: $tl-post-dot; |
| 64 | + height: $tl-post-dot; |
| 65 | + border-radius: 50%; |
| 66 | + background: var(--tl-node); |
94 | 67 | } |
95 | | - } /* #archives ul */ |
| 68 | + } |
96 | 69 |
|
97 | 70 | .date { |
98 | 71 | white-space: nowrap; |
99 | | - display: inline-block; |
100 | | - position: relative; |
101 | | - right: 0.5rem; |
| 72 | + color: var(--text-muted-color); |
| 73 | + font-size: 0.8rem; |
| 74 | + font-family: Lato, 'Microsoft Yahei', sans-serif; |
| 75 | + flex-shrink: 0; |
| 76 | + } |
102 | 77 |
|
103 | | - &.month { |
104 | | - width: 1.4rem; |
105 | | - text-align: center; |
106 | | - } |
| 78 | + a { |
| 79 | + color: var(--text-color); |
| 80 | + transition: color 0.2s ease; |
107 | 81 |
|
108 | | - &.day { |
109 | | - font-size: 85%; |
110 | | - font-family: Lato, sans-serif; |
| 82 | + &:hover { |
| 83 | + color: var(--link-color); |
| 84 | + text-decoration: none; |
111 | 85 | } |
112 | 86 | } |
113 | 87 |
|
114 | | - a { |
115 | | - /* post title in Archvies */ |
116 | | - margin-left: 2.5rem; |
117 | | - position: relative; |
118 | | - top: 0.1rem; |
| 88 | + @include bp.lt(bp.get(sm)) { |
| 89 | + padding-left: 1.25rem; |
119 | 90 |
|
120 | | - &:hover { |
121 | | - border-bottom: none; |
| 91 | + .year::before { |
| 92 | + left: calc(-1.25rem - #{$tl-line-w} / 2); |
122 | 93 | } |
123 | 94 |
|
124 | | - &::before { |
125 | | - /* the dot before post title */ |
126 | | - content: ''; |
127 | | - display: inline-block; |
128 | | - position: relative; |
129 | | - border-radius: 50%; |
130 | | - width: 8px; |
131 | | - height: 8px; |
132 | | - float: left; |
133 | | - top: 1.35rem; |
134 | | - left: 71px; |
135 | | - background-color: var(--timeline-node-bg); |
136 | | - box-shadow: 0 0 3px 0 #c2c6cc; |
137 | | - z-index: 1; |
| 95 | + li::before { |
| 96 | + left: calc(-1.25rem - #{$tl-line-w} / 2); |
138 | 97 | } |
139 | 98 | } |
140 | | -} /* #archives */ |
| 99 | +} |
0 commit comments