Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/components/CornerControls.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import ThemeToggle from './ThemeToggle.astro';
import { getLocale } from '../i18n';
import { getLocale, ui } from '../i18n';

const locale = getLocale(Astro.currentLocale);

Expand All @@ -11,11 +11,15 @@ const langClass = (active: boolean) =>
---

<div
role="group"
aria-label={ui[locale].corner.group}
class="fixed right-4 top-4 z-50 flex h-12 items-center gap-0.5 rounded-full border border-hairline bg-canvas/70 px-1.5 shadow-lg shadow-black/10 backdrop-blur-md"
>
<a
href="/"
data-lang-link
hreflang="en"
lang="en"
aria-label="English"
aria-current={locale === 'en' ? 'page' : undefined}
class={`hidden sm:block ${langClass(locale === 'en')}`}
Expand All @@ -25,6 +29,8 @@ const langClass = (active: boolean) =>
<a
href="/es/"
data-lang-link
hreflang="es"
lang="es"
aria-label="Español"
aria-current={locale === 'es' ? 'page' : undefined}
class={`hidden sm:block ${langClass(locale === 'es')}`}
Expand Down
6 changes: 5 additions & 1 deletion src/components/Nav.astro
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,12 @@ const links = [
}
</ul>

<div class="mt-1 flex items-center gap-1 border-t border-hairline px-3 py-3">
<div class="mt-1 flex items-center gap-1 border-t border-hairline px-3 py-3 sm:hidden">
<a
href="/"
data-lang-link
hreflang="en"
lang="en"
aria-label="English"
aria-current={locale === 'en' ? 'page' : undefined}
class={locale === 'en'
Expand All @@ -105,6 +107,8 @@ const links = [
<a
href="/es/"
data-lang-link
hreflang="es"
lang="es"
aria-label="Español"
aria-current={locale === 'es' ? 'page' : undefined}
class={locale === 'es'
Expand Down
9 changes: 9 additions & 0 deletions src/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ interface UIStrings {
footer: {
builtWith: string;
};
corner: {
group: string;
};
}

export const ui: Localized<UIStrings> = {
Expand Down Expand Up @@ -120,6 +123,9 @@ export const ui: Localized<UIStrings> = {
footer: {
builtWith: 'Built with Astro · Tailwind',
},
corner: {
group: 'Language and theme',
},
},
es: {
nav: {
Expand Down Expand Up @@ -178,6 +184,9 @@ export const ui: Localized<UIStrings> = {
footer: {
builtWith: 'Hecho con Astro · Tailwind',
},
corner: {
group: 'Idioma y tema',
},
},
};

Expand Down
2 changes: 2 additions & 0 deletions src/layouts/Base.astro
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ const ogImage = new URL('/og.png', siteBase).href;
<meta property="og:url" content={canonical} />
<meta property="og:image" content={ogImage} />
<meta property="og:site_name" content={profile.name} />
<meta property="og:locale" content={locale === 'es' ? 'es_ES' : 'en_US'} />
<meta property="og:locale:alternate" content={locale === 'es' ? 'en_US' : 'es_ES'} />

<!-- Twitter -->
<meta name="twitter:card" content="summary_large_image" />
Expand Down