diff --git a/src/lib/components/BlogCard.svelte b/src/lib/components/BlogCard.svelte index 161d579..1d31599 100644 --- a/src/lib/components/BlogCard.svelte +++ b/src/lib/components/BlogCard.svelte @@ -7,13 +7,21 @@ @@ -58,19 +69,31 @@ alt={post.thumbnailAlt ?? 'Миниатюра поста'} /> {/if} + {#if isPostFresh} +
+ {#if isPostUpdated} + ОБНОВЛЕНО + {:else} + НОВОЕ + {/if} +
+ {/if}
-
-
- -

- {new Date(post.date!).toLocaleString('default', { - month: 'short', - day: 'numeric', - year: 'numeric' - })} -

-
+
+ + {#if post.dateChanged} + + {/if}

{post.title}

@@ -87,6 +110,26 @@ .blog-card { @apply flex w-full max-w-5xl overflow-hidden rounded-lg bg-slate-100 text-slate-950 drop-shadow-xl transition-all hover:drop-shadow-2xl; + .toast { + @apply absolute top-0 right-0 rounded-bl-lg p-2 font-bold text-slate-50; + } + + &.updated { + box-shadow: 0 0 0 4px var(--color-purple-600); + + .toast { + @apply bg-purple-600; + } + } + + &.new { + box-shadow: 0 0 0 4px var(--color-amber-600); + + .toast { + @apply bg-amber-600; + } + } + img.thumbnail { @apply absolute h-full w-full object-cover transition-transform; diff --git a/src/lib/util/Blogs.ts b/src/lib/util/Blogs.ts index a45ceaa..47939b5 100644 --- a/src/lib/util/Blogs.ts +++ b/src/lib/util/Blogs.ts @@ -1,6 +1,7 @@ import path from 'path'; export const THUMBNAIL_DEFAULT = "https://teasanctuary.ru/common/background-day.webp"; +export const BLOG_POST_FRESHNESS_MILLIS = 3 * 24 * 60 * 60 * 1000; // 3 дня export type PostComparer = (a: App.BlogPost, b: App.BlogPost) => number;