Skip to content

Commit b49a362

Browse files
committed
feat: introduce inner marker styling
1 parent 7e4ddfc commit b49a362

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed

src/components/Timeline.css

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
.timeline {
22
--timeline-line-width: 0.2rem;
3+
--timeline-line-color: black;
34
--marker-line-width: var(--timeline-line-width);
5+
--marker-line-color: var(--timeline-line-color);
46
--marker-size: 1.5rem;
7+
--marker-color: var(--timeline-line-color);
8+
--marker-inner-size: 1rem;
9+
--marker-inner-color: white;
510

611
position: relative;
712
}
@@ -28,7 +33,7 @@ div.timeline__line {
2833
}
2934

3035
.timeline-item__content {
31-
border: 1px solid black;
36+
border: 0.2rem solid black;
3237
padding: 1rem;
3338
flex: 1;
3439
}
@@ -38,27 +43,46 @@ div.timeline-item__marker {
3843
height: var(--marker-line-width);
3944
margin-top: 2rem;
4045
width: 5rem;
41-
background-color: black;
46+
background-color: var(--marker-line-color);
4247
}
4348

44-
.timeline-item__marker::after {
49+
.timeline-item__marker::after,
50+
.timeline-item__marker::before {
4551
content: '';
4652
border-radius: 50%;
53+
position: absolute;
54+
}
55+
56+
.timeline-item__marker::before {
4757
width: var(--marker-size);
4858
height: var(--marker-size);
49-
background-color: black;
50-
position: absolute;
59+
background-color: var(--marker-color);
5160
top: calc(-1 * var(--marker-size) / 2 + var(--marker-line-width) / 2);
5261
}
5362

54-
.timeline-item--left .timeline-item__marker::after {
63+
.timeline-item__marker::after {
64+
width: var(--marker-inner-size);
65+
height: var(--marker-inner-size);
66+
background-color: var(--marker-inner-color);
67+
top: calc(-1 * var(--marker-inner-size) / 2 + var(--marker-line-width) / 2);
68+
}
69+
70+
.timeline-item--left .timeline-item__marker::before {
5571
right: calc(-1 * var(--marker-size) / 2);
5672
}
5773

58-
.timeline-item--right .timeline-item__marker::after {
74+
.timeline-item--left .timeline-item__marker::after {
75+
right: calc(-1 * var(--marker-inner-size) / 2);
76+
}
77+
78+
.timeline-item--right .timeline-item__marker::before {
5979
left: calc(-1 * var(--marker-size) / 2);
6080
}
6181

82+
.timeline-item--right .timeline-item__marker::after {
83+
left: calc(-1 * var(--marker-inner-size) / 2);
84+
}
85+
6286
.timeline-item--left .timeline-item__marker {
6387
order: 1;
6488
}

0 commit comments

Comments
 (0)