fix: add types for constants to avoid type errors when empty (#501)

Add types for `constants` to avoid type errors
when either `SOCIALS` or `SHARE_LINKS` is empty.

---------

Co-authored-by: satnaing <satnaingdev@gmail.com>
This commit is contained in:
kakomonn
2025-06-06 00:31:37 +08:00
committed by GitHub
parent 21bcca85ac
commit bd948604be
2 changed files with 30 additions and 22 deletions
+19 -19
View File
@@ -5,22 +5,22 @@ import LinkButton from "./LinkButton.astro";
const URL = Astro.url;
---
<div
class="flex flex-col flex-wrap items-center justify-center gap-1 sm:items-start"
>
<span class="italic">Share this post on:</span>
<div class="text-center">
{
SHARE_LINKS.map(social => (
<LinkButton
href={`${social.href + URL}`}
class="scale-90 p-2 hover:rotate-6 sm:p-1"
title={social.linkTitle}
>
<social.icon class="inline-block size-6 scale-125 fill-transparent stroke-current stroke-2 opacity-90 group-hover:fill-transparent sm:scale-110" />
<span class="sr-only">{social.linkTitle}</span>
</LinkButton>
))
}
</div>
</div>
{
SHARE_LINKS.length > 0 && (
<div class="flex flex-none flex-col items-center justify-center gap-1 sm:items-end">
<span class="italic">Share this post on:</span>
<div class="text-center">
{SHARE_LINKS.map(social => (
<LinkButton
href={`${social.href + URL}`}
class="scale-90 p-2 hover:rotate-6 sm:p-1"
title={social.linkTitle}
>
<social.icon class="inline-block size-6 scale-125 fill-transparent stroke-current stroke-2 opacity-90 group-hover:fill-transparent sm:scale-110" />
<span class="sr-only">{social.linkTitle}</span>
</LinkButton>
))}
</div>
</div>
)
}