Skip to content

Commit 052bcf4

Browse files
authored
feat(blog): kefka post (#1231)
* feat(blog): kefka post Signed-off-by: Xe Iaso <xe@tigrisdata.com> * fix(kefka): review feedback Signed-off-by: Xe Iaso <xe@tigrisdata.com> * feat(kefka): use a social preview link to the tigris blog Signed-off-by: Xe Iaso <xe@tigrisdata.com> --------- Signed-off-by: Xe Iaso <xe@tigrisdata.com>
1 parent 48f7cf1 commit 052bcf4

2 files changed

Lines changed: 397 additions & 0 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
export interface LinkPreviewCardProps {
2+
url: string;
3+
title: string;
4+
description?: string;
5+
/** Optional preview/OG image URL. When omitted the card renders text-only. */
6+
image?: string;
7+
/** Override the source label. Defaults to the URL's hostname. */
8+
siteName?: string;
9+
}
10+
11+
export default function LinkPreviewCard({
12+
url,
13+
title,
14+
description,
15+
image,
16+
siteName,
17+
}: LinkPreviewCardProps) {
18+
const host = siteName ?? new URL(url).hostname.replace(/^www\./, "");
19+
20+
return (
21+
<a
22+
href={url}
23+
target="_blank"
24+
rel="noopener noreferrer"
25+
class="group not-prose no-underline visited:no-underline flex flex-col sm:flex-row max-w-xl mx-auto my-8 overflow-hidden rounded-xl border border-bg-3 dark:border-bgDark-3 bg-bg-0 dark:bg-bgDark-0 shadow-sm transition duration-150 hover:-translate-y-0.5 hover:shadow-md"
26+
>
27+
{image && (
28+
<div class="sm:w-52 sm:shrink-0 aspect-[1.91/1] sm:aspect-auto overflow-hidden bg-bg-2 dark:bg-bgDark-2">
29+
<img
30+
src={image}
31+
alt=""
32+
loading="lazy"
33+
class="h-full w-full object-cover transition-transform duration-200 group-hover:scale-105"
34+
/>
35+
</div>
36+
)}
37+
<div class="flex flex-col justify-center gap-1 p-4">
38+
<span class="font-mono text-xs uppercase tracking-wide text-orange-light dark:text-orangeDark-light group-hover:text-bg-0 dark:group-hover:text-white">
39+
{host}
40+
</span>
41+
<span class="font-serif text-lg font-semibold leading-snug text-fg-0 dark:text-fgDark-0 group-hover:text-bg-0 dark:group-hover:text-white">
42+
{title}
43+
</span>
44+
{description && (
45+
<span class="text-sm leading-snug text-fg-3 dark:text-fgDark-3 line-clamp-3 group-hover:text-bg-1 dark:group-hover:text-bg-1">
46+
{description}
47+
</span>
48+
)}
49+
</div>
50+
</a>
51+
);
52+
}

0 commit comments

Comments
 (0)