Skip to content

Commit 1a606ed

Browse files
authored
Merge pull request #5 from UNC-Libraries/full-days
Adjust hours layout
2 parents bc1544a + 373aea1 commit 1a606ed

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

public/class-wplibcalhours-public.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ private function setDays($num_days, $data): array
197197
$date->add(new \DateInterval("P${i}D"));
198198
$key = $date->format('Y-m-d');
199199

200-
$day = array('date' => $date);
200+
$day = ['date' => $date];
201201
$day['text'] = (array_key_exists($key, $data)) ? $data[$key] : __('n/a', 'wplibcalhours');
202202
$day['is_today'] = $key === $today->format('Y-m-d');
203203
$days[] = $day;

public/css/wplibcalhours-public.css

+8-4
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@
2121
/* UNC additions */
2222
.hours-list-view {
2323
display: grid;
24+
grid-template-columns: 160px auto;
2425
grid-auto-flow: column;
25-
grid-template-columns: 1fr 1fr;
2626
grid-template-rows: repeat(4, 1fr);
27+
list-style-type: none;
2728
margin-top: 0 !important;
2829
padding-left: 5px !important;
30+
text-align: left;
2931
}
3032

3133
.hours-list-view-stacked {
@@ -34,9 +36,7 @@
3436
}
3537

3638
.hours-list-view li {
37-
display: inline-flex;
38-
justify-content: flex-start;
39-
width: 195px;
39+
padding-bottom: 5px;
4040
}
4141
.hours-day {
4242
font-weight: bold;
@@ -72,6 +72,10 @@
7272
text-align: left;
7373
}
7474

75+
.hours-more {
76+
margin-top: 25px;
77+
}
78+
7579
.hours-more button {
7680
border-radius: 5px;
7781
padding: 8px 10px;

public/partials/grid.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<?php
2-
$first_day = $days[array_key_first($days)]['text']['status'];
2+
try {
3+
$first_day = $days[array_key_first($days)]['text']['status'];
4+
} catch (TypeError $e) {
5+
$first_day = 'closed';
6+
}
7+
38
$open_class = ($first_day == 'open') ? 'circle-green' : 'circle-red';
49
$stacked = $attrs['display_type'] == 'stacked';
510
$hours_display = ($stacked) ? '-stacked' : '';
@@ -38,7 +43,7 @@ class="hours-list-view <?php echo $this->setClassList($stacked) ?>">
3843
$day = $chunked_week[$i];
3944
$today = $day['is_today'];
4045
$date = $day['date'];
41-
$day_text = ($today) ? 'Today' : $date->format('D'); ?>
46+
$day_text = ($today) ? 'Today' : $date->format('l'); ?>
4247

4348
<li <?php echo $this->setToday($today) ?>>
4449
<?php if ($week_number > 0): ?>

0 commit comments

Comments
 (0)