-
Notifications
You must be signed in to change notification settings - Fork 338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New start button icon #1329
New start button icon #1329
Changes from all commits
874e198
6e3eada
56ffd3f
ec74375
deb144c
38e63c7
3009eaf
97203ef
a898327
2b1ffbe
b4494f5
7838afa
5eec954
76ae9fa
c342139
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
{# Determine type of element to use, if not explicitly set -#} | ||
{# Set classes for this component #} | ||
{% set classNames = "govuk-button" %} | ||
|
||
|
||
{% if params.classes %} | ||
{% set classNames = classNames + " " + params.classes %} | ||
{% endif %} | ||
{% if params.disabled %} | ||
{% set classNames = classNames + " govuk-button--disabled" %} | ||
{% endif %} | ||
|
||
|
||
{# Determine type of element to use, if not explicitly set -#} | ||
{% if params.element %} | ||
{% set element = params.element | lower %} | ||
{% else %} | ||
|
@@ -10,9 +21,14 @@ | |
{% endif %} | ||
{% endif %} | ||
|
||
{% if params.isStartButton %} | ||
aliuk2012 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{% set iconMarkUp = '<svg class="govuk-button__start-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" height="19px" width="30px"><path fill="currentColor" d="M7.5 0H0l10 10L0 20h7.5l10-10-10-10z"/></svg>' %} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should check if we need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've tested this in IE and it doesn't appear to be an issue. I think this might because the svg is already in a focusable element like |
||
{% set classNames = classNames + " govuk-button--start" %} | ||
{% endif %} | ||
|
||
{#- Define common attributes that we can use across all element types #} | ||
|
||
{%- set commonAttributes %} class="govuk-button{% if params.classes %} {{ params.classes }}{% endif %}{% if params.disabled %} govuk-button--disabled{% endif %}"{% for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}{% endset %} | ||
{%- set commonAttributes %} class="{{ classNames }}" {% for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}{% endset %} | ||
|
||
{#- Define common attributes we can use for both button and input types #} | ||
|
||
|
@@ -23,11 +39,13 @@ | |
{%- if element == 'a' %} | ||
<a href="{{ params.href if params.href else '#' }}" role="button" draggable="false" {{- commonAttributes | safe }}> | ||
{{ params.html | safe if params.html else params.text }} | ||
{{ iconMarkUp | safe }} | ||
</a> | ||
|
||
{%- elseif element == 'button' %} | ||
<button {%- if params.value %} value="{{ params.value }}"{% endif %} {{- buttonAttributes | safe }} {{- commonAttributes | safe }}> | ||
{{ params.html | safe if params.html else params.text }} | ||
{{ iconMarkUp | safe }} | ||
</button> | ||
|
||
{%- elseif element == 'input' %} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to do this with a breakpoint?