b2in/resources/views/livewire/web/components/ui/announcement-bar.blade.php
Kevin Adametz 451e738c8b CMS: Absatz-Tags aus dem Rich-Text-Editor erscheinen nicht mehr als Text
Der Editor packt eingefügten Text in <p>; Felder wie die FAQ-Antwort gibt die Website als Text
aus, die Tags waren sichtbar. Beim Speichern entfernt unwrapParagraphs() die Absätze (ein
Absatz ohne <p>, mehrere mit <br><br>, Blockinhalte unverändert). cms_inline() gibt die
Felder als bereinigtes Inline-HTML aus – auch schon gespeicherte Texte mit <p> erscheinen
sauber, Fett und Hervorhebung werden dargestellt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 06:58:48 +00:00

52 lines
3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@if (!empty($content) && ($content['enabled'] ?? false))
{{-- Kein x-cloak: Livewire setzt global [x-cloak]{display:none!important}. Mit x-cloak wuerde
die Leiste dauerhaft verschwinden, sobald Alpine das Attribut nicht entfernt. Ohne Alpine
ist sie sichtbar – das ist hier der richtige Standardfall.
Der localStorage-Zugriff steht bewusst im x-data (kein Aufblitzen) und ist abgesichert,
weil er im privaten Modus oder bei blockiertem Storage wirft. --}}
<div x-data="(() => {
const key = @js($this->dismissKey);
let dismissed = false;
try { dismissed = localStorage.getItem(key) === 'true'; } catch (e) {}
return { key, dismissed };
})()"
x-show="!dismissed" x-transition:leave="transition ease-in duration-200"
x-transition:leave-start="opacity-100 max-h-16" x-transition:leave-end="opacity-0 max-h-0"
class="bg-primary text-secondary-foreground overflow-hidden" id="topbar">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="relative flex items-center justify-center gap-x-3 gap-y-1 flex-wrap min-h-10 py-2 pr-8 text-sm">
@if (isset($content['badge']))
<span
class="hidden sm:inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider bg-white/20 shrink-0">
{{ $content['badge'] }}
</span>
@endif
<span class="font-medium text-center leading-snug">
{!! cms_inline($content['text'] ?? '') !!}
</span>
@if (isset($content['link_text']) && isset($content['link_url']))
<a href="{{ $content['link_url'] }}"
class="inline-flex items-center gap-1 font-semibold underline underline-offset-2 decoration-white/50 hover:decoration-white transition-colors shrink-0">
{{ $content['link_text'] }}
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" stroke-width="2"
viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round"
d="M13.5 4.5L21 12m0 0l-7.5 7.5M21 12H3" />
</svg>
</a>
@endif
<button
@click="dismissed = true; try { localStorage.setItem(key, 'true') } catch (e) {}"
class="absolute right-0 top-1/2 -translate-y-1/2 p-1.5 text-white/60 hover:text-white transition-colors"
aria-label="{{ __('ui.announcement_close') }}">
<svg class="w-4 h-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
</div>
</div>
@endif