Поддержка событий в карточках блога

This commit is contained in:
Иван Кузьменко 2025-11-16 10:55:18 +03:00
parent 17db6d4f3e
commit 9b03d0c197
3 changed files with 101 additions and 30 deletions

View file

@ -10,7 +10,7 @@
class: className = ''
}: {
dateString?: string;
type?: 'published' | 'updated';
type?: 'published' | 'updated' | 'eventStart' | 'eventFinish';
highlight?: boolean;
showTime?: boolean;
class?: string;
@ -18,7 +18,9 @@
const typeToIcon = {
published: 'material-symbols:calendar-today',
updated: 'material-symbols:update'
updated: 'material-symbols:update',
eventStart: 'material-symbols:rocket-launch',
eventFinish: 'material-symbols:sports-score'
};
const icon = type ? typeToIcon[type] : undefined;
@ -28,7 +30,12 @@
<div
class="flex flex-nowrap items-center gap-2 p-1 text-lg font-bold {className} rounded-lg
{highlightClasses(type == 'published' ? 'bg-amber-600' : 'bg-purple-600')}
{highlightClasses(
type === 'published' ? 'bg-amber-600' : type === 'updated' ? 'bg-purple-600' : ''
)}
{highlightClasses(
type === 'eventStart' ? 'bg-rose-600' : type === 'eventFinish' ? 'bg-teal-600' : ''
)}
{highlightClasses('text-slate-50')}"
>
{#if icon}