-
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 Buy a ticket pattern (#778)
* add buy a ticket pattern page * add buy a ticket macro * add buy a ticket styles * add secondary colour class * add text and section styles * add correct classes and njk props * remove excess tags and classes * remove question class * fix active btn styles * add more semantic markup Co-authored-by: Catia Costa <34938764+catiarodriguescosta@users.noreply.github.com>
- Loading branch information
1 parent
0c8f5ea
commit 175a7db
Showing
7 changed files
with
196 additions
and
1 deletion.
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,124 @@ | ||
{% macro wmndsBuyATicket() %} | ||
{# Imports #} | ||
{% from "wmnds/components/button/_button.njk" import wmndsButton %} | ||
{% from "wmnds/components/icon/_icon.njk" import wmndsIcon %} | ||
{% from "wmnds/components/form-elements/dropdown/_dropdown.njk" import wmndsDropdown %} | ||
|
||
<form class="wmnds-buy-a-ticket"> | ||
<h2 class="wmnds-buy-a-ticket__title">Buy a ticket</h2> | ||
{# Mode select #} | ||
<div class="wmnds-m-b-md wmnds-p-b-xsm"> | ||
<fieldset class="wmnds-buy-a-ticket__mode-checkboxes"> | ||
<legend class="wmnds-buy-a-ticket__label">Which modes of transport will you use?</legend> | ||
<div class="wmnds-grid wmnds-grid--spacing-3-sm wmnds-grid--spacing-sm-3-md"> | ||
<label class="wmnds-col-1-3"> | ||
<input type="checkbox" class="wmnds-buy-a-ticket__mode-checkbox wmnds-screenreaders-only" name="useBus"> | ||
<div class="wmnds-btn wmnds-btn--mode wmnds-btn--block"> | ||
{{ | ||
wmndsIcon({ | ||
icon: 'modes-isolated-bus', | ||
class: 'wmnds-btn__icon ' | ||
}) | ||
}} | ||
Bus | ||
</div> | ||
</label> | ||
<label class="wmnds-col-1-3"> | ||
<input type="checkbox" class="wmnds-buy-a-ticket__mode-checkbox wmnds-screenreaders-only" name="useTrain"> | ||
<div class="wmnds-btn wmnds-btn--mode wmnds-btn--block"> | ||
{{ | ||
wmndsIcon({ | ||
icon: 'modes-isolated-rail', | ||
class: 'wmnds-btn__icon ' | ||
}) | ||
}} | ||
Train | ||
</div> | ||
</label> | ||
<label class="wmnds-col-1-3"> | ||
<input type="checkbox" class="wmnds-buy-a-ticket__mode-checkbox wmnds-screenreaders-only" name="useTram"> | ||
<div class="wmnds-btn wmnds-btn--mode wmnds-btn--block"> | ||
{{ | ||
wmndsIcon({ | ||
icon: 'modes-isolated-metro', | ||
class: 'wmnds-btn__icon ' | ||
}) | ||
}} | ||
Tram | ||
</div> | ||
</label> | ||
</div> | ||
</fieldset> | ||
</div> | ||
{# Traveller dropdown #} | ||
{{ | ||
wmndsDropdown({ | ||
id: 'buyATicketPassengerType', | ||
name: 'PassengerType', | ||
groupClasses: 'wmnds-m-b-md wmnds-p-b-xsm', | ||
label: "Who will be travelling?", | ||
labelClasses: 'wmnds-buy-a-ticket__label', | ||
secondaryColor: true, | ||
items: [ | ||
{ | ||
contentText: 'Select traveller', | ||
selected: true, | ||
disabled: true | ||
}, | ||
{ | ||
contentText: 'Option 1', | ||
value: 'option1' | ||
}, | ||
{ | ||
contentText: 'Option 2', | ||
value: 'option2' | ||
}, | ||
{ | ||
contentText: 'Option 3', | ||
value: 'option3' | ||
} | ||
] | ||
}) | ||
}} | ||
{# Duration dropdown #} | ||
{{ | ||
wmndsDropdown({ | ||
id: "buyATicketDuration", | ||
name: "Duration", | ||
groupClasses: 'wmnds-m-b-md wmnds-p-b-xsm', | ||
label: "How long will the ticket last for?", | ||
labelClasses: 'wmnds-buy-a-ticket__label', | ||
secondaryColor: true, | ||
items: [ | ||
{ | ||
contentText: 'Select ticket length', | ||
selected: true, | ||
disabled: true | ||
}, | ||
{ | ||
contentText: 'Option 1', | ||
value: 'option1' | ||
}, | ||
{ | ||
contentText: 'Option 2', | ||
value: 'option2' | ||
}, | ||
{ | ||
contentText: 'Option 3', | ||
value: 'option3' | ||
} | ||
] | ||
}) | ||
}} | ||
{# Submit button #} | ||
{{ | ||
wmndsButton({ | ||
iconRight: "general-chevron-right", | ||
contentText: "Find tickets", | ||
role: "submit" | ||
}) | ||
}} | ||
</form> | ||
|
||
|
||
{% 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,31 @@ | ||
.wmnds-buy-a-ticket { | ||
padding: $size-md; | ||
background: get-color(primary); | ||
|
||
&__title, | ||
&__label { | ||
color: $white; | ||
} | ||
|
||
&__label { | ||
display: block; | ||
margin-bottom: $size-sm; | ||
font-weight: 600; | ||
} | ||
|
||
&__mode-checkboxes { | ||
padding: 0; | ||
border: 0; | ||
} | ||
|
||
&__mode-checkbox { | ||
&:focus + .wmnds-btn--mode { | ||
background-color: $white; | ||
box-shadow: 0 0 0 2px $white, 0 0 0 4px get-color(secondary); | ||
} | ||
|
||
&:checked + .wmnds-btn--mode { | ||
background-color: get-color(secondary, 50); | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -212,6 +212,9 @@ | |
{ | ||
"name": "Banner" | ||
}, | ||
{ | ||
"name": "Buy a ticket" | ||
}, | ||
{ | ||
"name": "Cookies" | ||
}, | ||
|
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 @@ | ||
{% extends "www/_layouts/layout-left-pane.njk" %} | ||
{% set pageTitle = "Buy a ticket" %} | ||
{% set section="Patterns" %} | ||
{% from "www/_partials/component-example/component-example.njk" import compExample %} | ||
{% from "wmnds/patterns/buy-a-ticket/_buy-a-ticket.njk" import wmndsBuyATicket %} | ||
|
||
{% block content %} | ||
|
||
{% markdown %} | ||
|
||
## What does it do? | ||
|
||
- Helps users to enter the ticket purchase journey straight from the homepage | ||
|
||
## When to use it? | ||
|
||
- On the homepage | ||
|
||
## How it works? | ||
|
||
- This pattern directs users to the ticket finder service, where they can continue with purchasing a relevant ticket based on the ticket options they have selected | ||
|
||
{% endmarkdown %} | ||
|
||
{{ | ||
compExample([ | ||
wmndsBuyATicket() | ||
]) | ||
}} | ||
|
||
{% endblock %} |