diff options
| author | Ariel Costas Guerrero <94913521+arielcostas@users.noreply.github.com> | 2025-03-14 23:33:56 +0100 |
|---|---|---|
| committer | Ariel Costas Guerrero <94913521+arielcostas@users.noreply.github.com> | 2025-03-14 23:33:56 +0100 |
| commit | e3c4bb2efa513973bc26949a8be62fbe66e31a4f (patch) | |
| tree | 75a46cbde3ec2d36cfd33bff63ae7c65d145c182 /src/layouts/ContactPageLayout.astro | |
| parent | 54dab1e00b38693e96c801d0c5a020693a35bbda (diff) | |
Implement new page layouts for Home, Contact, Portfolio, and Trajectory; update header and footer for multilingual support
Diffstat (limited to 'src/layouts/ContactPageLayout.astro')
| -rw-r--r-- | src/layouts/ContactPageLayout.astro | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/src/layouts/ContactPageLayout.astro b/src/layouts/ContactPageLayout.astro new file mode 100644 index 0000000..3b3c278 --- /dev/null +++ b/src/layouts/ContactPageLayout.astro @@ -0,0 +1,99 @@ +--- +import { useTranslations } from "../i18n"; +import Layout from "./Layout.astro"; + +const t = useTranslations(Astro.currentLocale); + +const schema = { + "@context": "https://schema.org", + "@type": "ContactPage", + url: "https://www.costas.dev/contact", + headline: t.contactPage.headline, +}; +--- + +<Layout title={t.contactPage.title} description={t.contactPage.description}> + <script + is:inline + type="application/ld+json" + slot="head-jsonld" + set:html={JSON.stringify(schema)} + /> + + <h1>{t.contactPage.headline}</h1> + + <noscript> + <div role="alert" class="warning"> + {t.contactPage.enableJs} + </div> + </noscript> + + <p set:html={t.contactPage.intro} /> + + <p>{t.contactPage.socialMedia}</p> + + <dl> + <dt>GitHub</dt> + <dd><a href="https://github.com/arielcostas">@arielcostas</a></dd> + <dt>LinkedIn</dt> + <dd> + <a href="https://www.linkedin.com/in/ariel-costas/" + >/in/ariel-costas</a> + </dd> + <dt>BlueSky</dt> + <dd><a href="https://bsky.app/profile/costas.dev">@costas.dev</a></dd> + </dl> +</Layout> + +<script> + const encryptedEmail = "LygNLiMmFRo/GlQZaFIWBA=="; + const encryptedPhoneNumber = "ZWlQfX1QT0Z+XgVd"; + const key = "NZdKOfvuLn5jF6sryF0Q"; + + const emailAddrLink = document.getElementById( + "email-addr", + ) as HTMLAnchorElement; + const phoneNumberLink = document.getElementById( + "phone-number", + ) as HTMLAnchorElement; + + (() => { + if (emailAddrLink == null || phoneNumberLink == null) { + return; + } + + const emailAddress = xorData(encryptedEmail, key); + const phoneNumber = xorData(encryptedPhoneNumber, key); + + emailAddrLink.href = `mailto:${emailAddress}`; + emailAddrLink.textContent = emailAddress; + + phoneNumberLink.href = `tel:${phoneNumber}`; + phoneNumberLink.textContent = phoneNumber; + })(); + + function xorData(data: string, key: string): string { + let actualData = atob(data); + let actualKey = key; + const keyLength = key.length; + const dataLength = actualData.length; + const result = new Array(dataLength); + + // If the key is 12 characters but the data is 30 characters, the key should be repeated 3 times and truncated to 30 characters + if (keyLength < dataLength) { + actualKey = key + .repeat(Math.ceil(dataLength / keyLength)) + .substring(0, dataLength); + } else if (keyLength > dataLength) { + actualKey = key.substring(0, dataLength); + } + + for (let i = 0; i < dataLength; i++) { + result[i] = String.fromCharCode( + actualData.charCodeAt(i) ^ actualKey.charCodeAt(i), + ); + } + + return result.join(""); + } +</script> |
