Skip to content

Commit 6a51040

Browse files
author
Simon Sendler
committed
feat: add shortcut for double icons to icon component
1 parent c582f10 commit 6a51040

2 files changed

Lines changed: 33 additions & 9 deletions

File tree

src/main/webapp/WEB-INF/taglibs/util.taglib.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626
<required>false</required>
2727
<type>java.lang.String</type>
2828
</attribute>
29+
<attribute>
30+
<description>Whether the icon should be displayed as a double icon</description>
31+
<name>double</name>
32+
<required>false</required>
33+
<type>java.lang.Boolean</type>
34+
</attribute>
2935
</tag>
3036
<tag>
3137
<tag-name>icon-text</tag-name>

src/main/webapp/WEB-INF/taglibs/util/icon.xhtml

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,31 @@
55
xmlns:xlink="http://www.w3.org/1999/xlink"
66
>
77
<c:set var="filled" value="#{filled == 'true' ? 'filled' : 'outline'}" />
8-
<span
9-
class="icon-wrapper#{styleClass != null ? ' ' : ''}#{styleClass}"
10-
aria-hidden="true"
11-
title="#{title}"
12-
data-toggle="#{title != null ? 'tooltip' : ''}">
13-
<svg>
14-
<use href="#{HelperForm.applicationWebsiteUrl}resources/icons/#{filled}/#{icon}.svg#icon" />
15-
</svg>
16-
</span>
8+
<c:choose>
9+
<c:when test="#{double == true}">
10+
<span
11+
class="icon-wrapper#{styleClass != null ? ' ' : ''}#{styleClass}"
12+
aria-hidden="true"
13+
title="#{title}"
14+
data-toggle="#{title != null ? 'tooltip' : ''}">
15+
<svg>
16+
<use href="#{HelperForm.applicationWebsiteUrl}resources/icons/#{filled}/#{icon}.svg#icon" />
17+
</svg>
18+
<svg style="margin-inline-start: -5px;">
19+
<use href="#{HelperForm.applicationWebsiteUrl}resources/icons/#{filled}/#{icon}.svg#icon" />
20+
</svg>
21+
</span>
22+
</c:when>
23+
<c:otherwise>
24+
<span
25+
class="icon-wrapper#{styleClass != null ? ' ' : ''}#{styleClass}"
26+
aria-hidden="true"
27+
title="#{title}"
28+
data-toggle="#{title != null ? 'tooltip' : ''}">
29+
<svg>
30+
<use href="#{HelperForm.applicationWebsiteUrl}resources/icons/#{filled}/#{icon}.svg#icon" />
31+
</svg>
32+
</span>
33+
</c:otherwise>
34+
</c:choose>
1735
</ui:component>

0 commit comments

Comments
 (0)