@php
    /** @var array{id: int, title: string, url: string, level: string, level_label: string, level_color: string, pinned: bool, is_read: bool, published_at_label: ?string} $item */
    $keyPrefix = $keyPrefix ?? 'item';
@endphp

<li wire:key="official-news-{{ $keyPrefix }}-{{ $item['id'] }}">
    <a
        href="{{ $item['url'] }}"
        target="_blank"
        rel="noopener noreferrer"
        wire:click="markAsRead({{ $item['id'] }})"
        @class([
            'fi-admin-official-news__item',
            'fi-admin-official-news__item--unread' => ! $item['is_read'],
        ])
    >
        <div class="fi-admin-official-news__item-meta">
            <x-filament::badge :color="$item['level_color']" size="sm">
                {{ $item['level_label'] }}
            </x-filament::badge>
            @if ($item['pinned'])
                <span class="fi-admin-official-news__pinned">{{ __('dberp.official_news.pinned') }}</span>
            @endif
            @if (filled($item['published_at_label']))
                <span class="fi-admin-official-news__time">{{ $item['published_at_label'] }}</span>
            @endif
        </div>
        <p class="fi-admin-official-news__item-title">{{ $item['title'] }}</p>
    </a>
</li>
