Skip to content

Commit 6889a88

Browse files
authored
Timescale: Improve the visibility (#335)
Fixes the issues mentioned in #292
2 parents 3cc4625 + 98255d7 commit 6889a88

2 files changed

Lines changed: 17 additions & 13 deletions

File tree

library/Notifications/Widget/TimeGrid/Timescale.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ public function assemble(): void
6666
$time = new DateTime();
6767
$dayTimestamps = [];
6868
for ($i = 0; $i < $timestampPerDay; $i++) {
69-
// am-pm is separated by non-breaking whitespace
70-
$parts = preg_split('/\s/u', $dateFormatter->format($time->setTime($i * $timeIntervals, 0)));
71-
72-
$stamp = [new HtmlElement('span', null, new Text($parts[0]))];
73-
if (isset($parts[1])) {
74-
$stamp[] = new HtmlElement('span', null, new Text($parts[1]));
75-
}
69+
$stamp = array_map(
70+
function ($part) {
71+
return new HtmlElement('span', null, new Text($part));
72+
},
73+
// am-pm is separated by non-breaking whitespace
74+
preg_split('/\s/u', $dateFormatter->format($time->setTime($i * $timeIntervals, 0)))
75+
);
7676

7777
$dayTimestamps[] = new HtmlElement('span', new Attributes(['class' => 'timestamp']), ...$stamp);
7878
$dayTimestamps[] = new HtmlElement('span', new Attributes(['class' => 'ticks']));

public/css/timeline.less

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@
7474

7575
.timescale {
7676
display: grid;
77-
grid-template-columns: repeat(~"calc(var(--primaryColumns) * var(--timestampsPerDay))", minmax(0,1fr));
77+
grid-template-columns: repeat(
78+
~"calc(var(--primaryColumns) * var(--timestampsPerDay))",
79+
minmax(~"calc(var(--minimumPrimaryColumnWidth) / var(--timestampsPerDay))", 1fr)
80+
);
81+
7882
border-left: 1px solid @gray-lighter; // this is required to maintain the grid layout
7983
grid-area: ~"4 / 2 / 4 / 3";
8084

@@ -100,7 +104,7 @@
100104
align-items: center;
101105
margin-top: 0.5em;
102106
padding-top: 0.5em;
103-
font-size: .5em;
107+
font-size: .75em;
104108
position: relative;
105109
left: -50%;
106110
line-height: 1;
@@ -114,21 +118,21 @@
114118
}
115119
}
116120

117-
span:nth-last-of-type(2), // last .ticks before .midnight
118-
.midnight {
121+
> span.ticks:nth-last-of-type(2), // last .ticks and .midnight
122+
> .timestamp.midnight {
119123
grid-area: ~"1 / -2 / 1 / -1";
120124
}
121125
}
122126

123127
.clock {
124128
display: grid;
125-
grid-template-columns: repeat(var(--primaryColumns), 1fr);
129+
grid-template-columns: repeat(var(--primaryColumns), minmax(var(--minimumPrimaryColumnWidth), 1fr));
126130
grid-area: ~"3 / 2 / 4 / 3";
127131
border-top: 1px solid transparent; // left not required, otherwise the .time-hand is not aligned properly
128132

129133
.current-day {
130134
display: grid;
131-
grid-template-columns: repeat(var(--columnsPerStep), 1fr);
135+
grid-template-columns: repeat(var(--columnsPerStep), minmax(var(--minimumStepColumnWidth), 1fr));
132136
grid-area: ~"1 / 1 / 2 / 2";
133137

134138
.time-hand {

0 commit comments

Comments
 (0)