-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* GW-88 Allow tags to be links * GW-88 Tidied tag markup Refactored tag markup and added example for local dev with a custom class added to a tag
- Loading branch information
1 parent
195c363
commit 4a978c7
Showing
3 changed files
with
35 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
{% macro tag(tag) %} | ||
{% if tag.modifier %} | ||
<span class="{{ tag.className if tag.className }} tag tag--{{ tag.modifier }}"> | ||
{{ tag.label }} | ||
</span> | ||
{% else %} | ||
<span class="{{ tag.className if tag.className }} tag{% for modifier in tag.modifiers %} tag--{{ modifier }}{% endfor %}"> | ||
{{ tag.label }} | ||
</span> | ||
{% endif %} | ||
{% set modifier %} | ||
{% if tag.modifier %} | ||
tag--{{ tag.modifier }} | ||
{% else %} | ||
{% for modifier in tag.modifiers %} tag--{{ modifier }}{% endfor %} | ||
{% endif %} | ||
{% endset %} | ||
|
||
{% set tagName %}{{ "a" if tag.href else "span" }}{% endset %} | ||
|
||
{% set href %}{% if tag.href %}href="{{tag.href}}"{% endif %}{% endset %} | ||
|
||
<{{ tagName }} class="tag {{ modifier | trim }} {{ tag.className if tag.className }}" {{ href }}> | ||
{{ tag.label }} | ||
</{{ tagName }}> | ||
{% endmacro %} |