astro-accelerator 5.10.33 → 5.10.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.10.33",
2
+ "version": "5.10.34",
3
3
  "author": "Steve Fenton",
4
4
  "name": "astro-accelerator",
5
5
  "description": "A super-lightweight, accessible, SEO-friendly starter project for Astro",
@@ -1389,6 +1389,11 @@ figure:focus .magnify-button {
1389
1389
  box-shadow: var(--box-shadow-unselected);
1390
1390
  }
1391
1391
 
1392
+ .timeline-event.event-today > button {
1393
+ border: 1px solid var(--icon-block);
1394
+ background: var(--aft);
1395
+ }
1396
+
1392
1397
  .timeline-event.event-past > button {
1393
1398
  opacity: 0.8;
1394
1399
  background: var(--aft);
@@ -1396,7 +1401,6 @@ figure:focus .magnify-button {
1396
1401
  box-shadow: none;
1397
1402
  }
1398
1403
 
1399
-
1400
1404
  .timeline-event > button:hover,
1401
1405
  .timeline-event > button:focus {
1402
1406
  outline: none;
@@ -17,11 +17,19 @@ const dataAttributeName = 'data-timeline';
17
17
  */
18
18
  function setTimelineEvents() {
19
19
  const today = new Date();
20
+ today.setHours(0, 0, 0, 0);
21
+ const todayTimestamp = today.getTime();
22
+
20
23
  qsa('[' + dataAttributeName + '] time').forEach((timeEl) => {
21
24
  const eventDate = new Date(timeEl.getAttribute('datetime'));
22
25
  eventDate.setHours(0, 0, 0, 0);
23
-
24
- if (eventDate < today) {
26
+ const eventTimestamp = eventDate.getTime();
27
+
28
+ console.log(todayTimestamp, eventTimestamp);
29
+
30
+ if (eventTimestamp === todayTimestamp) {
31
+ timeEl.closest('.timeline-event').classList.add('event-today');
32
+ } else if (eventTimestamp < todayTimestamp) {
25
33
  timeEl.closest('.timeline-event').classList.add('event-past');
26
34
  }
27
35
  });
@@ -0,0 +1,39 @@
1
+ ---
2
+ import { SITE } from "@config";
3
+
4
+ interface Props {
5
+ date: string;
6
+ title: string;
7
+ location: string;
8
+ description: string;
9
+ linkHref: string;
10
+ linkText: string;
11
+ }
12
+
13
+ const { date, title, location, description, linkHref, linkText } = Astro.props;
14
+
15
+ const dateObj = new Date(date);
16
+ const displayDate = dateObj.toLocaleDateString(
17
+ SITE.default.locale,
18
+ SITE.dateOptions as any,
19
+ );
20
+ ---
21
+
22
+ <div class="timeline-event">
23
+ <button aria-expanded="false">
24
+ <time datetime={date}>{displayDate}</time>
25
+ <h3>{title}</h3>
26
+ <span class="timeline-location">{location}</span>
27
+
28
+ <div class="timeline-details">
29
+ <p>{description}</p>
30
+ {
31
+ linkHref && (
32
+ <a href={linkHref} class="button">
33
+ {linkText}
34
+ </a>
35
+ )
36
+ }
37
+ </div>
38
+ </button>
39
+ </div>