feat: explicit icon map for hotel cms-data response

This commit is contained in:
Björn Fromme
2026-08-20 14:45:05 +02:00
parent ef439f6faf
commit 0a1683667f
4 changed files with 19 additions and 29 deletions
+6 -24
View File
@@ -109,36 +109,18 @@
} %}
{% block body %}
{% set icons = ctx.hotelCmsData.icons %}
{% set iconMap = {
bedsCount: { icon: 'bed', label: 'Anzahl Betten' },
parkingCount: { icon: 'parking', label: 'Anzahl Parkplätze' },
altitude: { icon: 'mountain', label: 'Höhe' },
partyroom: { icon: 'party', label: 'Partyraum' },
gamesroom: { icon: 'dice', label: 'Spieleraum' },
distanceBus: { icon: 'bus', label: 'Entfernung Bus' },
distanceLift: { icon: 'lift', label: 'Entfernung Lifte' },
sauna: { icon: 'sauna', label: 'Sauna' },
shower: { icon: 'shower', label: 'Dusche' },
wifi: { icon: 'wifi', label: 'WiFi' },
} %}
{% if icons is not empty %}
<ul class="grid grid-cols-2 md:grid-cols-3 gap-2">
{% for key, value in icons %}
{% set mapping = iconMap[key] ?? null %}
{% set isBool = value is same as(true) or value is same as(false) %}
{% for item in icons %}
<li class="flex items-center gap-2">
<div class="border-2 border-gray-900 rounded-full w-16 h-16 shrink-0 flex flex-col items-center justify-center">
{% if mapping %}
{{ icon(mapping.icon, 'w-8 h-8 shrink-0 text-gray-900') }}
{% endif %}
</div>
<div class="text-sm font-bold">
{% if isBool %}
{{ mapping ? mapping.label : '' }}
{% else %}
{{ mapping ? mapping.label ~ ': ' ~ value : value }}
{% if item.icon %}
{{ icon(item.icon, 'w-8 h-8 shrink-0 text-gray-900') }}
{% endif %}
</div>
{% if item.label is not same as(false) %}
<div class="text-sm font-bold">{{ item.label }}</div>
{% endif %}
</li>
{% endfor %}
</ul>