-
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 journey planner pattern and update pattern page (#781)
* Add jorney planner (based on the widget code). Update the pattern page for both. * Adding missing aria-labels. * Delete Anything else section. * Update used domain. * Add missing endblock. * Update button mode active color and update switch color.
- Loading branch information
1 parent
f968ff0
commit cd44140
Showing
9 changed files
with
408 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const journeyPlannerJS = () => {}; | ||
|
||
export default journeyPlannerJS; |
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,11 @@ | ||
{% raw %} | ||
{% from "wmnds/components/journey-planner/_journey-planner.njk" import wmndsJourneyPlanner %} | ||
{{ | ||
wmndsJourneyPlanner({ | ||
isOpen: true, | ||
isHowOpen: false, | ||
isWhenOpen: false | ||
}) | ||
}} | ||
{% endraw %} |
228 changes: 228 additions & 0 deletions
228
src/wmnds/patterns/journey-planner/_journey-planner.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,228 @@ | ||
{% macro wmndsJourneyPlanner(params) %} | ||
|
||
{# Imports of components #} | ||
{% from "wmnds/patterns/autocomplete/_autocomplete.njk" import wmndsAutocomplete %} | ||
{% from "wmnds/components/button/_button.njk" import wmndsButton %} | ||
{% from "wmnds/components/link/link/_link.njk" import wmndsLink %} | ||
{% from "wmnds/components/icon/_icon.njk" import wmndsIcon %} | ||
{% from "wmnds/components/form-elements/dropdown/_dropdown.njk" import wmndsDropdown %} | ||
{% from "wmnds/components/message/summary/_summary.njk" import wmndsMsgSummary %} | ||
|
||
|
||
{# Set params #} | ||
{% set formTitle = params.formTitle if params.formTitle else "Plan your journey" %} | ||
{% set isOpen = " wmnds-is--open" if params.isOpen %} | ||
{% set suffix = "--opened" if params.isOpen else "--collapsed" %} | ||
{% set detailsBtnText = "Hide details" if params.isOpen else "Add details" %} | ||
{% set detailsBtnIcon = "general-minimise" if params.isOpen else "general-expand" %} | ||
{% set marginTopClass = "" if params.isOpen else "wmnds-m-t-lg" %} | ||
|
||
|
||
|
||
|
||
<div style="max-width: 448px"> | ||
|
||
<div class="wmnds-journey-planner {{isOpen}}"> | ||
|
||
<div class="wmnds-p-md"> | ||
|
||
<h2>{{formTitle}}</h2> | ||
|
||
<form class="wmnds-journey-planner__form" name="jphome" action="//journeyplanner.wmnetwork.co.uk/Home/HandleWidgetQuery" method="GET"> | ||
|
||
<div class="wmnds-journey-planner__from"> | ||
{{ | ||
wmndsAutocomplete({ | ||
id: ("mainjp-from" + suffix ), | ||
name: "origin", | ||
label: { | ||
contentText: 'From', | ||
classes: "h5" | ||
}, | ||
placeholder: 'Enter station or postcode', | ||
loading: false, | ||
showSuggestions: false, | ||
textSuggestions: true, | ||
isRequired: true | ||
}) | ||
}} | ||
</div> | ||
|
||
<div class="wmnds-journey-planner__to"> | ||
<div class="wmnds-journey-planner__switch"> | ||
{{ | ||
wmndsButton({ | ||
type: "link", | ||
contentText: "Switch", | ||
classes: "wmnds-m-t--lg" | ||
}) | ||
}} | ||
|
||
{{ | ||
wmndsIcon({ | ||
icon: 'general-swap', | ||
class: 'wmnds-journey-planner__switch-icon' | ||
}) | safe | ||
}} | ||
</div> | ||
|
||
{{ | ||
wmndsAutocomplete({ | ||
id: ("mainjp-to" + suffix), | ||
name: "destination", | ||
label: { | ||
contentText: 'To', | ||
classes: "h5" | ||
}, | ||
placeholder: 'Enter station or postcode', | ||
loading: false, | ||
showSuggestions: false, | ||
textSuggestions: true, | ||
isRequired: true | ||
}) | ||
}} | ||
|
||
</div> | ||
|
||
|
||
<div class="wmnds-journey-planner__how"> | ||
<h5>Which modes of transport will you use?</h5> | ||
<div class="wmnds-grid wmnds-grid--spacing-3-sm"> | ||
<div class="wmnds-col-1-3"> | ||
<input type="checkbox" class="wmnds-screenreaders-only" name="useBus" aria-label="bus" checked/> | ||
{{ | ||
wmndsButton({ | ||
iconLeft: "modes-isolated-bus", | ||
contentText: "Bus", | ||
type: "mode", | ||
classes:"wmnds-col-1" | ||
}) | ||
}} | ||
</div> | ||
<div class="wmnds-col-1-3"> | ||
<input type="checkbox" class="wmnds-screenreaders-only" name="useTram" aria-label="tram" checked/> | ||
{{ | ||
wmndsButton({ | ||
iconLeft: "modes-isolated-metro", | ||
contentText: "Tram", | ||
type: "mode", | ||
classes:"wmnds-col-1" | ||
}) | ||
}} | ||
</div> | ||
<div class="wmnds-col-1-3"> | ||
<input type="checkbox" class="wmnds-screenreaders-only" name="useTrain" aria-label="train" checked /> | ||
{{ | ||
wmndsButton({ | ||
iconLeft: "modes-isolated-rail", | ||
contentText: "Train", | ||
type: "mode", | ||
classes:"wmnds-col-1" | ||
}) | ||
}} | ||
</div> | ||
|
||
|
||
</div> | ||
</div> | ||
|
||
<div class="wmnds-journey-planner__when"> | ||
|
||
<h5>Leaving</h5> | ||
<input type="hidden" name="journeyTimeType" value="leave"/> | ||
|
||
<div class="wmnds-grid wmnds-grid--spacing-2-lg"> | ||
<div class="wmnds-col-2-3"> | ||
{{ | ||
wmndsDropdown({ | ||
id: ("mainjp-day" + suffix ), | ||
secondaryColor: true, | ||
name: "day", | ||
items: [ | ||
{ | ||
value: "today", | ||
contentText: "Today", | ||
selected: true, | ||
disabled: false | ||
}, | ||
{ | ||
value: "tomorrow", | ||
contentText: "Tomorrow", | ||
selected: false, | ||
disabled: false | ||
} | ||
], | ||
describedBy: null, | ||
label: "Day", | ||
labelClasses: "wmnds-screenreaders-only", | ||
classes: null, | ||
error: false, | ||
errorMessage: { | ||
id: null, | ||
contentText: "Please select an option", | ||
contentHTML: null, | ||
classes: null | ||
} | ||
}) | ||
}} | ||
</div> | ||
<div class="wmnds-col-1-3"> | ||
{{ | ||
wmndsDropdown({ | ||
id: ("mainjp-time" + suffix), | ||
name: "SelectJourneyTime", | ||
secondaryColor: true, | ||
type: "time", | ||
describedBy: null, | ||
label: "Time", | ||
labelClasses: "wmnds-screenreaders-only", | ||
classes: null, | ||
error: false, | ||
errorMessage: { | ||
id: null, | ||
contentText: "Please select an option", | ||
contentHTML: null, | ||
classes: null | ||
} | ||
}) | ||
}} | ||
</div> | ||
</div> | ||
|
||
</div> | ||
|
||
<div class="wmnds-journey-planner__submit {{marginTopClass}}"> | ||
<div class="wmnds-grid wmnds-grid--spacing-2-lg"> | ||
<div class="wmnds-col-1-2"> | ||
{{ | ||
wmndsButton({ | ||
contentText: detailsBtnText, | ||
classes: "wmnds-btn--block wmnds-btn--align-left", | ||
role: "button", | ||
isDarkBg: true, | ||
iconRight: detailsBtnIcon | ||
}) | ||
}} | ||
</div> | ||
<div class="wmnds-col-1-2"> | ||
{{ | ||
wmndsButton({ | ||
contentText: "Plan my journey", | ||
classes: "wmnds-btn--block wmnds-btn--align-left", | ||
role: "submit", | ||
iconRight: "general-chevron-right" | ||
}) | ||
}} | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</form> | ||
</div> | ||
|
||
|
||
</div> | ||
</div> | ||
|
||
|
||
{% endmacro %} |
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,54 @@ | ||
.wmnds-journey-planner { | ||
color: $white; | ||
background-color: get-color(primary); | ||
|
||
h2, | ||
.wmnds-btn--link { | ||
color: $white; | ||
} | ||
|
||
&__form { | ||
& > div:not(.wmnds-journey-planner__from):not(.wmnds-journey-planner__to):not(.wmnds-journey-planner__submit) { | ||
display: none; | ||
} | ||
} | ||
|
||
&.wmnds-is--open { | ||
& .wmnds-journey-planner__form > div { | ||
display: block !important; | ||
} | ||
} | ||
|
||
&__to { | ||
position: relative; | ||
} | ||
|
||
&__switch { | ||
display: flex; | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
align-items: center; | ||
justify-content: flex-end; | ||
} | ||
|
||
&__switch-icon { | ||
width: 17px; | ||
height: 23px; | ||
margin-left: 8px; | ||
fill: $white; | ||
} | ||
|
||
.wmnds-btn--mode:active, | ||
.wmnds-btn--mode:focus, | ||
.wmnds-btn--mode:target { | ||
background-color: get-color(secondary, 50); | ||
} | ||
|
||
// Leave and arrive for when, modes for how | ||
&__when, | ||
&__how { | ||
position: relative; | ||
|
||
} | ||
} |
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,19 @@ | ||
{ | ||
"wmndsJourneyPlannerProps": [ | ||
{ | ||
"name": "isOpen", | ||
"type": "boolean", | ||
"description": "If true, journey planner will be expanded. Defaults to <code class='wmnds-website-inline-code'>false</code>." | ||
}, | ||
{ | ||
"name": "isWhenOpen", | ||
"type": "boolean", | ||
"description": "If true, journey planner area to define when you want to travel will be expanded. Defaults to <code class='wmnds-website-inline-code'>false</code>." | ||
}, | ||
{ | ||
"name": "isHowOpen", | ||
"type": "boolean", | ||
"description": "If true, journey planner area to define how (the mode of travel) do you want to travel will be expanded. Defaults to <code class='wmnds-website-inline-code'>false</code>." | ||
} | ||
] | ||
} |
Oops, something went wrong.