Created
January 30, 2018 11:31
-
-
Save tameemsafi/e91871dbc13b53d3da37468d205e1a31 to your computer and use it in GitHub Desktop.
Nunjucks - Example macro
This file contains hidden or 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
{% macro button(text='', url=false, start=false, disabled=false) %} | |
{% set disabledCode = 'disabled="disabled" aria-disabled="true"' %} | |
{% if url %} | |
<a class="button {{ 'button-start' if start }}" href="{{ url }}" role="button">{{ text }}</a> | |
{% else %} | |
<input class="button" type="submit" value="{{ text }}" {{ disabledCode if disabled }}> | |
{% endif %} | |
{% endmacro %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment