diff --git a/src/assets/icons/close.svg b/src/assets/icons/close.svg new file mode 100644 index 0000000..ddaf2d7 --- /dev/null +++ b/src/assets/icons/close.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/components/ShareDialog.astro b/src/components/ShareDialog.astro new file mode 100644 index 0000000..99ce4e3 --- /dev/null +++ b/src/components/ShareDialog.astro @@ -0,0 +1,293 @@ +--- +import { getLocaleFromUrl, useTranslations } from "@i18n"; +import { Image } from "astro:assets"; +import type { BlogData } from "src/content.config"; +import Clembs from "@assets/icons/clembs.svg"; +import Bluesky from "@assets/icons/bluesky.svg"; +import Twitter from "@assets/icons/twitter.svg"; +import Email from "@assets/icons/email.svg"; +import Copy from "@assets/icons/copy.svg"; +import Share from "@assets/icons/share.svg"; + +type Props = { + post: BlogData; +}; + +const { post } = Astro.props; + +const lang = getLocaleFromUrl(Astro.url); +const t = useTranslations(lang); + +const text = t(`blog.share_article_text`).replace("{title}", post.title); +const url = Astro.url.pathname; +--- + + + + + {t("blog.share_article_modal_title")} + + + { + post.bannerPath && ( + + ) + } + + + + clembs.com + + + {post.title} + + + {post.summary} + + + + + + + + + + + Bluesky + + + + + + + Twitter + + + + + + + Email + + + + + + + {t("copy_link")} + + + + + + + {t("other")} + + + + + diff --git a/src/i18n/langs/en.ts b/src/i18n/langs/en.ts index 5bd4b85..3f25018 100644 --- a/src/i18n/langs/en.ts +++ b/src/i18n/langs/en.ts @@ -3,6 +3,8 @@ export default { about: "about", now: "now", blog: "blog", + copy_link: "Copy link", + other: "Other", footer_legal_blurb: "All rights reserved.", "intro.tronche.alt": "My highly professional and whimsical face", "intro.eyebrow": "Hi, I'm Clément, welcome to my website!", @@ -31,6 +33,8 @@ export default { "blog.available_in": "Available in", "blog.available_in_and": "and", "blog.share_article": "Share article", + "blog.share_article_modal_title": "Share this article", + "blog.share_article_text": "Read Clément Voisin's {title}:", "blog.view_project": "View project", "blog.edited_on": "Edited on", "blog.warning_unlocalized": diff --git a/src/i18n/langs/fr.ts b/src/i18n/langs/fr.ts index bf57835..75f17dc 100644 --- a/src/i18n/langs/fr.ts +++ b/src/i18n/langs/fr.ts @@ -5,6 +5,8 @@ export const fr: typeof en = { about: "à propos", now: "maintenant", blog: "blog", + copy_link: "Copier le lien", + other: "Autre", footer_legal_blurb: "Tous droits réservés.", "intro.tronche.alt": "Ma tête ulta professionnelle et pleine de joie", "intro.eyebrow": "Salut, c'est Clément. Bienvenue sur mon site !", @@ -34,6 +36,8 @@ export const fr: typeof en = { "blog.available_in": "Disponible en", "blog.available_in_and": "et en", "blog.share_article": "Partager", + "blog.share_article_modal_title": "Partager cet article", + "blog.share_article_text": "Je lis {title} de Clément Voisin :", "blog.view_project": "Voir le projet", "blog.edited_on": "Édité le", "blog.warning_unlocalized": diff --git a/src/layouts/Blog.astro b/src/layouts/Blog.astro index 20f7779..21bb9a7 100644 --- a/src/layouts/Blog.astro +++ b/src/layouts/Blog.astro @@ -7,6 +7,7 @@ import Layout from "./Layout.astro"; import { Image } from "astro:assets"; import { getLocaleFromUrl, getPostSlug, useTranslations } from "@i18n"; import type { CollectionEntry } from "astro:content"; +import ShareDialog from "@components/ShareDialog.astro"; type Props = { post: CollectionEntry<"blog">; @@ -25,11 +26,27 @@ const lang = getLocaleFromUrl(Astro.url); const t = useTranslations(lang); --- + + + + {post.data.title} @@ -75,7 +92,13 @@ const t = useTranslations(lang); ) } - + +
+ {post.summary} +