-
Notifications
You must be signed in to change notification settings - Fork 332
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Button component variants from YAML file (#251)
* Update component to use yaml data * Update example class message
- Loading branch information
Jani Kraner
authored
Oct 6, 2017
1 parent
abf2f9b
commit 4559379
Showing
7 changed files
with
54 additions
and
17 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{% from "button/macro.njk" import govukButton %} | ||
|
||
{{ govukButton(classes='', text='Save and continue') }} | ||
{{ govukButton({classes: '', text:'Save and continue', url: '', isStart: '', isDisabled: ''}) }} |
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,14 @@ | ||
variants: | ||
- name: default | ||
data: | ||
text: Save and continue | ||
classes: 'example-class' | ||
- name: disabled | ||
data: | ||
text: Disabled button | ||
isDisabled: true | ||
- name: start | ||
data: | ||
text: Start now | ||
url: / | ||
isStart: true |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{% macro govukButton(classes='', text, url, isStart, isDisabled) %} | ||
{% macro govukButton(params) %} | ||
{%- include "./template.njk" -%} | ||
{% 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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
{% if url %} | ||
{% if params.url %} | ||
<a class="govuk-c-button | ||
{%- if isStart %} govuk-c-button--start{% endif %} | ||
{%- if classes %} {{ classes }}{% endif %}" href="{{ url | safe }}" role="button"> | ||
{%- if text %}{{ text }}{% endif %} | ||
{%- if params.isStart %} govuk-c-button--start{% endif %} | ||
{%- if params.classes %} {{ params.classes }}{% endif %}" href="{{ params.url | safe }}" role="button"> | ||
{%- if params.text %}{{ params.text }}{% endif %} | ||
</a> | ||
{% else %} | ||
<input class="govuk-c-button | ||
{%- if isDisabled %} govuk-c-button--disabled{% endif %} | ||
{%- if classes %} {{ classes }}{% endif %}" | ||
{%- if text %} value="{{ text }}"{% endif %} | ||
{%- if isDisabled %} disabled="disabled" aria-disabled="true"{% endif %}> | ||
{%- if params.isDisabled %} govuk-c-button--disabled{% endif %} | ||
{%- if params.classes %} {{ params.classes }}{% endif %}" | ||
{%- if params.text %} value="{{ params.text }}"{% endif %} | ||
{%- if params.isDisabled %} disabled="disabled" aria-disabled="true"{% endif %}> | ||
{% endif %} |