1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-06 16:56:44 +02:00

[ticket/15538] Create macro and remove icons

PHPBB3-15538
This commit is contained in:
mrgoldy
2019-09-30 16:42:03 +02:00
committed by Marc Alexander
parent 094f0f663c
commit d8274c19c8
14 changed files with 200 additions and 178 deletions

View File

@@ -0,0 +1,33 @@
{# Wrapper function #}
{% macro Icon(type, icon, classes = '', title = '', hidden = false, attributes = {}) %}
{% set type = type|capitalize %}
{% if type in ['Fa', 'Png', 'Svg'] %}
{{ attribute(_self, type, [icon, classes, title, hidden, attributes]) }}
{% endif %}
{% endmacro Icon %}
{# FA icons #}
{% macro Fa(icon, classes = '', title = '', hidden = false, attributes = {}) %}
<i class="o-icon font fa-{{ icon ~ Implode_classes(classes) }}"{% if hidden %}{% if title %} title="{{ lang(title) }}"{% endif %} aria-hidden="true"{% endif %}{{ _self.attributes(attributes) }}></i>
{% if title %}<span{% if hidden %} class="sr-only"{% endif %}>{{ lang(title) }}</span>{% endif %}
{% endmacro Fa %}
{# PNG icons #}
{% macro Png(icon, classes = '', title = '', hidden = false, attributes = {}) %}
<img class="o-icon png png-{{ icon ~ Implode_classes(classes) }}" src="{{ icon|png_path }}" alt="{{ lang(title) }}"{{ _self.attributes(attributes) }}
{% endmacro Png %}
{# SVG icons #}
{% macro Svg(icon, classes = '', title = '', hidden = false, attributes = {}) %}
{% set title_id = title ? title|lower|replace({' ': '_'}) ~ '-' ~ random() %}
<svg class="o-icon svg svg-{{ icon ~ Implode_classes(classes) }}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"{% if title %}{% if hidden %} aria-hidden="true"{% endif %} aria-labelledby="{{ title_id }}"{% endif %} role="img"{{ _self.attributes(attributes) }}>
{% if title %}
<title id="{{ title_id }}">{{ lang(title) }}</title>
{% endif %}
{{ svg_clean(icon) }}
</svg>
{% endmacro Svg %}

View File

@@ -1,11 +0,0 @@
{% spaceless %}
<i
class="o-icon font fa-{{ ICON ~ (CLASSES ? ' ' ~ CLASSES) }}"
{% if S_HIDDEN %}
{% if TITLE %}title="{{ lang(TITLE) }}"{% endif %}
aria-hidden="true"
{% endif %}
{{ ATTRIBUTES }}
></i>
{% if TITLE %}<span{% if S_HIDDEN %} class="sr-only"{% endif %}>{{ lang(TITLE) }}</span>{% endif %}
{% endspaceless %}

View File

@@ -1,8 +0,0 @@
{% spaceless %}
<img
class="o-icon png png-{{ ICON ~ (CLASSES ? ' ' ~ CLASSES) }}"
src="{{ SOURCE }}"
alt="{{ lang(TITLE) }}"
{{ ATTRIBUTES }}
/>
{% endspaceless %}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

View File

@@ -1,22 +0,0 @@
{% spaceless %}
{% set TITLE_ID = TITLE ? TITLE|lower|replace({' ': '-'}) ~ '-' ~ random() %}
<svg
class="o-icon svg svg-{{ ICON ~ (CLASSES ? ' ' ~ CLASSES) }}"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
{% if TITLE %}
{% if S_HIDDEN %}aria-hidden="true"{% endif %}
aria-labelledby="{{ TITLE_ID }}"
{% endif %}
role="img"
{{ ATTRIBUTES }}
>
{% if TITLE %}
<title id="{{ TITLE_ID }}">
{{ lang(TITLE) }}
</title>
{% endif %}
{{ SOURCE }}
</svg>
{% endspaceless %}

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path fill="red" d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/></svg>

Before

Width:  |  Height:  |  Size: 195 B

View File

@@ -1 +0,0 @@
<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V8l8 5 8-5v10zm-8-7L4 6h16l-8 5z"/></svg>

Before

Width:  |  Height:  |  Size: 261 B

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><title>My fake title!</title><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"/><path d="M0 0h24v24H0z" fill="none"/></svg>

Before

Width:  |  Height:  |  Size: 317 B

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M20.01 15.38c-1.23 0-2.42-.2-3.53-.56-.35-.12-.74-.03-1.01.24l-1.57 1.97c-2.83-1.35-5.48-3.9-6.89-6.83l1.95-1.66c.27-.28.35-.67.24-1.02-.37-1.11-.56-2.3-.56-3.53 0-.54-.45-.99-.99-.99H4.19C3.65 3 3 3.24 3 3.99 3 13.28 10.73 21 20.01 21c.71 0 .99-.63.99-1.18v-3.45c0-.54-.45-.99-.99-.99z"/></svg>

Before

Width:  |  Height:  |  Size: 425 B