-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add live departures patterns (#885)
* add page & copy * style bus departures * add favourites button to buttons * Add live departures service styling * my live departures styling * style my live departures edit mode * style table train live departures * add documentation and params for bus departures * add docs and params for live deps service * add documentation + params for live deps widget * Documentation + params for live deps train * added remove button labels * Update src/wmnds/patterns/live-departures/live-departures-widget/_properties.njk.json Co-authored-by: Gil <43111519+gldgrnt@users.noreply.github.com> * change filtered results Co-authored-by: Gil <43111519+gldgrnt@users.noreply.github.com>
- Loading branch information
Showing
20 changed files
with
1,470 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/wmnds/patterns/live-departures/live-departures-bus/_example.njk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{% raw %} | ||
{% from "wmnds/patterns/live-departures/live-departures-bus/_live-departures-bus.njk" import wmndsLiveDeparturesBus %} | ||
{{ | ||
wmndsLiveDeparturesBus({ | ||
services: [ | ||
{ | ||
name: "16", | ||
destination: "Wolverhampton", | ||
operator: "National Express West Midlands", | ||
times: [3, 7, 28] | ||
}, | ||
{ | ||
name: "17", | ||
destination: "Dudley", | ||
operator: "National Express West Midlands", | ||
times: [4, 14, 24] | ||
}, | ||
{ | ||
name: "17A", | ||
destination: "Wall Heath", | ||
operator: "Diamond", | ||
times: [8, 19, 27] | ||
}, | ||
{ | ||
name: "57", | ||
destination: "Wall Heath", | ||
operator: "National Express West Midlands", | ||
times: [6, 16, 26] | ||
}, | ||
{ | ||
name: "125", | ||
destination: "Bridgnorth", | ||
operator: "Diamond", | ||
times: [9, 14, 24] | ||
} | ||
] | ||
}) | ||
}} | ||
{% endraw %} |
50 changes: 50 additions & 0 deletions
50
src/wmnds/patterns/live-departures/live-departures-bus/_live-departures-bus.njk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{% macro wmndsLiveDeparturesBus(params) %} | ||
|
||
{% set services = params.services if params.services else [ | ||
{ | ||
name: "16", | ||
destination: "Wolverhampton", | ||
operator: "National Express West Midlands", | ||
times: [3, 7, 28] | ||
}, | ||
{ | ||
name: "16", | ||
destination: "Wolverhampton", | ||
operator: "National Express West Midlands", | ||
times: [3, 7, 28] | ||
}, | ||
{ | ||
name: "16", | ||
destination: "Wolverhampton", | ||
operator: "National Express West Midlands", | ||
times: [3, 7, 28] | ||
} | ||
] %} | ||
|
||
<div style="max-width: 640px;"> | ||
<div class="wmnds-live-departures wmnds-live-departures--bus"> | ||
{% for service in services %} | ||
<div class="wmnds-live-departures__service wmnds-grid wmnds-grid--spacing-sm-2-md wmnds-grid--justify-between"> | ||
<div class="wmnds-col-1 wmnds-col-sm-1-2"> | ||
<div class="wmnds-live-departures__service-details"> | ||
<div class="wmnds-live-departures__service-name">{{ service.name }}</div> | ||
<div class="wmnds-live-departures__service-description"> | ||
<strong>{{ service.destination }}</strong> | ||
<span class="wmnds-live-departures__service-operator">{{ service.operator }}</span> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="wmnds-col-1 wmnds-col-sm-1-2"> | ||
<div class="wmnds-live-departures__times"> | ||
{% for time in service.times %} | ||
<div class="wmnds-live-departures__time">{{ time }} mins</div> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
|
||
|
||
{% endmacro %} |
31 changes: 31 additions & 0 deletions
31
src/wmnds/patterns/live-departures/live-departures-bus/_properties.njk.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"wmndsLiveDeparturesBusProps": [ | ||
{ | ||
"name": "service", | ||
"type": "array", | ||
"description": "Array of objects containing the bus service information", | ||
"arrayOptions": [ | ||
{ | ||
"name": "name", | ||
"type": "string", | ||
"description": "The name of the bus service e.g. 16" | ||
}, | ||
{ | ||
"name": "destination", | ||
"type": "string", | ||
"description": "The bus service destination name" | ||
}, | ||
{ | ||
"name": "operator", | ||
"type": "string", | ||
"description": "The bus service operator name" | ||
}, | ||
{ | ||
"name": "times", | ||
"type": "array", | ||
"description": "Array of departure times to show" | ||
} | ||
] | ||
} | ||
] | ||
} |
12 changes: 12 additions & 0 deletions
12
src/wmnds/patterns/live-departures/live-departures-service/_example.njk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% raw %} | ||
{% from "wmnds/patterns/live-departures/live-departures-service/_live-departures-service.njk" import wmndsLiveDeparturesService %} | ||
{{ | ||
wmndsLiveDeparturesService({ | ||
name: "MM1", | ||
operator: null, | ||
destination: "Birmingham - Wolverhampton", | ||
lastUpdated: "9:30am", | ||
times: [4, 14, 24, 34, 44] | ||
}) | ||
}} | ||
{% endraw %} |
50 changes: 50 additions & 0 deletions
50
src/wmnds/patterns/live-departures/live-departures-service/_live-departures-service.njk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{% macro wmndsLiveDeparturesService(params) %} | ||
|
||
{% set name = params.name if params.name else "16" %} | ||
{% set destination = params.destination if params.destination else "Stourbridge - Wolverhampton via Kingswinford" %} | ||
{% set operator = params.operator if params.operator else null %} | ||
{% set times = params.times if params.times else [4, 14, 24, 34, 44] %} | ||
{% set lastUpdated = params.lastUpdated if params.lastUpdated else "9:30am" %} | ||
{% set isTram = true if name | lower == "mm1" else false %} | ||
|
||
{# import components #} | ||
{% from "wmnds/components/button/_button.njk" import wmndsButton %} | ||
|
||
<div style="max-width: 640px;"> | ||
<div class="wmnds-live-departures wmnds-live-departures--service"> | ||
<div class="wmnds-live-departures__service-details wmnds-m-b-md"> | ||
<div class="wmnds-live-departures__service-name">{{ name }}</div> | ||
<div class="wmnds-live-departures__service-description"> | ||
<div class="wmnds-h3 wmnds-m-none">{{ destination }}</div> | ||
</div> | ||
</div> | ||
{% if operator %} | ||
<p><a href="#">{{ operator }}</a> runs this service</p> | ||
{% endif %} | ||
{{ | ||
wmndsButton({ | ||
type: "favourite", | ||
contentText: "Add to homepage", | ||
iconLeft: "general-star-empty" | ||
}) | ||
}} | ||
<hr> | ||
<div class="wmnds-grid wmnds-grid--justify-between wmnds-grid--spacing-md-2-md"> | ||
<div class="wmnds-col-1 wmnds-col-md-auto"> | ||
<div class="wmnds-h3 wmnds-m-t-none wmnds-m-b-md">Real time departures</div> | ||
<p class="wmnds-m-b-md">See when the next {% if isTram %}tram{% else %}{{ name + ' bus' }}{% endif %} leaves this stop</p> | ||
</div> | ||
<div class="wmnds-col-1 wmnds-col-md-auto"> | ||
<p class="wmnds-live-departures__last-updated">Last updated {{ lastUpdated }}</p> | ||
</div> | ||
</div> | ||
<div class="wmnds-live-departures__times"> | ||
{% for time in times %} | ||
<div class="wmnds-live-departures__time">{{ time }} mins</div> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
{% endmacro %} |
29 changes: 29 additions & 0 deletions
29
src/wmnds/patterns/live-departures/live-departures-service/_properties.njk.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"wmndsLiveDeparturesServiceProps": [ | ||
{ | ||
"name": "name", | ||
"type": "string", | ||
"description": "The name of the service e.g. 16" | ||
}, | ||
{ | ||
"name": "destination", | ||
"type": "string", | ||
"description": "The bus service destination name" | ||
}, | ||
{ | ||
"name": "lastUpdated", | ||
"type": "string", | ||
"description": "The time of last departure update e.g. 9:30am" | ||
}, | ||
{ | ||
"name": "operator", | ||
"type": "string", | ||
"description": "The service operator name" | ||
}, | ||
{ | ||
"name": "times", | ||
"type": "array", | ||
"description": "Array of departure times to show" | ||
} | ||
] | ||
} |
75 changes: 75 additions & 0 deletions
75
src/wmnds/patterns/live-departures/live-departures-train/_example.njk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{% raw %} | ||
{% from "wmnds/patterns/live-departures/live-departures-train/_live-departures-train.njk" import wmndsLiveDeparturesTrain %} | ||
{{ | ||
wmndsLiveDeparturesTrain({ | ||
showFiltered: false, | ||
lastUpdated: "09:30am", | ||
departures: [ | ||
{ | ||
train: "Kidderminster", | ||
operator: "West Midlands Railway", | ||
status: null, | ||
time: "08:21", | ||
platform: 2 | ||
}, | ||
{ | ||
train: "London Marylebone", | ||
operator: "Chiltern Railways", | ||
platform: 1, | ||
time: "08:25" | ||
}, | ||
{ | ||
train: "Stratford-upon-Avon", | ||
operator: "West Midlands Railway", | ||
platform: 1, | ||
time: "08:31" | ||
}, | ||
{ | ||
train: "Worcester Forgate Street", | ||
operator: "West Midlands Railway", | ||
status: "Cancelled" | ||
}, | ||
{ | ||
train: "Dorridge", | ||
operator: "West Midlands Railway", | ||
platform: 1, | ||
time: "08:40" | ||
} | ||
], | ||
arrivals: [ | ||
{ | ||
train: "Kidderminster", | ||
operator: "West Midlands Railway", | ||
status: null, | ||
time: "08:21", | ||
platform: 2 | ||
}, | ||
{ | ||
train: "London Marylebone", | ||
operator: "Chiltern Railways", | ||
platform: 1, | ||
time: "08:25" | ||
}, | ||
{ | ||
train: "Stratford-upon-Avon", | ||
operator: "West Midlands Railway", | ||
platform: 1, | ||
time: "08:31" | ||
}, | ||
{ | ||
train: "Worcester Forgate Street", | ||
operator: "West Midlands Railway", | ||
platform: 2, | ||
time: "08:36", | ||
status: "6 mins late" | ||
}, | ||
{ | ||
train: "Dorridge", | ||
operator: "West Midlands Railway", | ||
platform: 1, | ||
time: "08:40" | ||
} | ||
] | ||
}) | ||
}} | ||
{% endraw %} |
Oops, something went wrong.