diff --git a/src/components/ShareLinks.astro b/src/components/ShareLinks.astro index ed12dc7..55a642a 100644 --- a/src/components/ShareLinks.astro +++ b/src/components/ShareLinks.astro @@ -5,22 +5,22 @@ import LinkButton from "./LinkButton.astro"; const URL = Astro.url; --- -
- Share this post on: -
- { - SHARE_LINKS.map(social => ( - - - {social.linkTitle} - - )) - } -
-
+{ + SHARE_LINKS.length > 0 && ( +
+ Share this post on: +
+ {SHARE_LINKS.map(social => ( + + + {social.linkTitle} + + ))} +
+
+ ) +} diff --git a/src/constants.ts b/src/constants.ts index dd42e77..27800de 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,3 +1,4 @@ +import type { Props } from "astro"; import IconMail from "@/assets/icons/IconMail.svg"; import IconGitHub from "@/assets/icons/IconGitHub.svg"; import IconBrandX from "@/assets/icons/IconBrandX.svg"; @@ -8,11 +9,18 @@ import IconTelegram from "@/assets/icons/IconTelegram.svg"; import IconPinterest from "@/assets/icons/IconPinterest.svg"; import { SITE } from "@/config"; -export const SOCIALS = [ +interface Social { + name: string; + href: string; + linkTitle: string; + icon: (_props: Props) => Element; +} + +export const SOCIALS: Social[] = [ { name: "Github", href: "https://github.com/satnaing/astro-paper", - linkTitle: ` ${SITE.title} on Github`, + linkTitle: `${SITE.title} on Github`, icon: IconGitHub, }, { @@ -35,7 +43,7 @@ export const SOCIALS = [ }, ] as const; -export const SHARE_LINKS = [ +export const SHARE_LINKS: Social[] = [ { name: "WhatsApp", href: "https://wa.me/?text=",