File tree Expand file tree Collapse file tree 6 files changed +90
-15
lines changed
Expand file tree Collapse file tree 6 files changed +90
-15
lines changed Original file line number Diff line number Diff line change 1+ # EditorConfig is awesome: https://EditorConfig.org
2+
3+ # top-most EditorConfig file
4+ root = true
5+
6+ # Unix-style newlines with a newline ending every file
7+ [* ]
8+ end_of_line = lf
9+ charset = utf-8
10+ insert_final_newline = true
11+ indent_style = space
12+ indent_size = 2
Original file line number Diff line number Diff line change @@ -20,6 +20,18 @@ module.exports = function (eleventyConfig) {
2020 return `Eleventy ${ eleventyVersion } ` ;
2121 } ) ;
2222
23+ eleventyConfig . addFilter ( 'formatDateTime' , function ( date ) {
24+ return date . toLocaleDateString ( 'en-US' , {
25+ year : 'numeric' ,
26+ month : 'long' ,
27+ day : 'numeric' ,
28+ weekday : 'long' ,
29+ hour : 'numeric' ,
30+ minute : 'numeric' ,
31+ timeZoneName : 'short' ,
32+ } ) ;
33+ } ) ;
34+
2335 eleventyConfig . addPlugin ( inclusiveLangPlugin ) ;
2436
2537 if ( process . env . ELEVENTY_ENV === 'production' ) {
Original file line number Diff line number Diff line change 1+ module . exports = [
2+ {
3+ title : 'November Meetup' ,
4+ date : new Date ( '2020-11-25T18:00-06:00' ) ,
5+ link : 'https://www.meetup.com/JavaScriptMN/' ,
6+ location : 'Virtual' ,
7+ hidden : true ,
8+ } ,
9+ {
10+ title : 'October Meetup' ,
11+ date : new Date ( '2020-10-28T18:00-05:00' ) ,
12+ link : 'https://www.meetup.com/JavaScriptMN/events/hmzgxrybcnblc/' ,
13+ location : 'Virtual' ,
14+ } ,
15+ ] . sort ( ( a , b ) => b . date . getTime ( ) - a . date . getTime ( ) ) ;
Original file line number Diff line number Diff line change 1+ ( function ( ) {
2+ const upcoming = document . getElementById ( 'upcoming-event' ) ;
3+ const fallback = document . getElementById ( 'upcoming-event-fallback' ) ;
4+
5+ const upcomingDate = new Date (
6+ upcoming . querySelector ( 'time[datetime]' ) . getAttribute ( 'datetime' )
7+ ) ;
8+ // show the event time until the end of the day it's scheduled for
9+ upcomingDate . setHours ( 23 , 59 , 59 , 999 ) ;
10+ if ( Date . now ( ) > upcomingDate . getTime ( ) ) {
11+ upcoming . classList . add ( 'hidden' ) ;
12+ fallback . classList . remove ( 'hidden' ) ;
13+ }
14+ } ) ( ) ;
Original file line number Diff line number Diff line change 1+ {% set event = events | rejectattr (' hidden' ) | first %}
2+
3+ <div class =" mb-8" >
4+ <h2
5+ class =" inline-block bg-black text-white text-2xl font-bold px-4 mb-2 transform -rotate-1"
6+ >
7+ Upcoming
8+ </h2 >
9+ {# next event #}
10+ <div class =" bg-jsmn-yellow text-2xl p-4" id =" upcoming-event" >
11+ <h3 class =" font-bold" >{{ event .title }} </h3 >
12+ <p class =" text-lg" >
13+ <time datetime =" {{ event.date.toISOString() }}" >
14+ {{ event .date | formatDateTime }}
15+ </time >
16+ <br >
17+ {{ event .location }}
18+ </p >
19+ <p >
20+ <a href =" {{ event.link }}" class =" text-lg font-bold underline" >Details & RSVP</a >
21+ </p >
22+ </div >
23+ {# fallback #}
24+ <div class =" bg-jsmn-yellow text-2xl font-bold p-4 hidden"
25+ id =" upcoming-event-fallback" >
26+ <a href =" https://www.meetup.com/javascriptmn/" class =" underline" >Check
27+ Meetup.com for updates</a >
28+ </div >
29+ </div >
30+
31+ {% set js %}
32+ {% include " nextEvent.js" %}
33+ {% endset %}
34+ <script type =" text/javascript" >
35+ {{ js | jsmin | safe }}
36+ </script >
Original file line number Diff line number Diff line change @@ -33,21 +33,7 @@ changeFreq: daily
3333<div class =" container mx-auto px-2 mb-10" >
3434 <div class =" x-h-screen flex justify-center items-center" >
3535 <div class =" w-full" >
36- <div class =" mb-8" >
37- <h2
38- class =" inline-block bg-black text-white text-2xl font-bold px-4 mb-2 transform -rotate-1"
39- >
40- Upcoming
41- </h2 >
42- <div class =" bg-jsmn-yellow text-2xl font-bold p-4" >
43- Eleventy
44- <small
45- >and the
46- <abbr title =" Just Another Monstrosity" >JAM</abbr > fad</small
47- >
48- <i >by Brian Mitchell and Ryan Rampersad</i >
49- </div >
50- </div >
36+ {% include ' nextEvent.njk' %}
5137 <div >
5238 <div class =" flex justify-end items-center mb-2" >
5339 <h2
You can’t perform that action at this time.
0 commit comments