mirror of
https://github.com/tabler/tabler.git
synced 2025-12-21 17:34:25 +04:00
32 lines
1.3 KiB
HTML
32 lines
1.3 KiB
HTML
{%- assign icon-name = include.icon -%}
|
|
{%- assign icon-type = include.type | default: "outline" -%}
|
|
|
|
{%- assign replace-to = "icon" -%}
|
|
|
|
{%- if include.class -%}
|
|
{%- assign replace-to = replace-to | append: ' ' | append: include.class -%}
|
|
{%- endif -%}
|
|
|
|
{%- if include.color -%}
|
|
{%- assign replace-to = replace-to | append: ' text-' | append: include.color -%}
|
|
{%- endif %}
|
|
|
|
{%- if include.inline -%}
|
|
{%- assign replace-to = replace-to | append: ' icon-inline' -%}
|
|
{%- endif -%}
|
|
|
|
{%- if include['size'] -%}
|
|
{%- assign replace-to = replace-to | append: ' icon-' | append: include['size'] -%}
|
|
{%- endif -%}
|
|
|
|
{%- assign replace-to = 'class="' | append: replace-to | append: '"' -%}
|
|
|
|
{%- if site.useIconfont -%}
|
|
<i class="icon ti ti-{{ icon-name }}{% if include.color %} {{ include.color }}{% endif %}{% if include.class %} {{ include.class }}{% endif %}"></i>
|
|
{%- elsif icons[icon-name] -%}
|
|
<!-- Download SVG icon from http://tabler.io/icons/icon/{{ icon-name }} -->
|
|
{% assign svg-icon = icons[icon-name].svg[icon-type] | default: '' -%}
|
|
{%- assign svg-icon = svg-icon | replace: '<path stroke="none" d="M0 0h24v24H0z" fill="none"/>', '' -%}
|
|
{{ svg-icon | replace_regex: 'class=\"[^"]+\"', replace-to | replace: 'class="', 'aria-hidden="true" focusable="false" class="' }}
|
|
{%- endif -%}
|