diff --git a/package-lock.json b/package-lock.json index 5631d81..abbf371 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "typescript": "^5.4.5" }, "devDependencies": { + "@tailwindcss/forms": "^0.5.7", "@tailwindcss/typography": "^0.5.13" } }, @@ -1685,6 +1686,18 @@ "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.3.0.tgz", "integrity": "sha512-7fedsBfuILDTBmrYZNFI8B6ATTxhQAasUHllHmjvSZPnoq4bULWoTpHwmuQvZ8Aq03/tAa2IGo6RXqWtHdWaCA==" }, + "node_modules/@tailwindcss/forms": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.5.7.tgz", + "integrity": "sha512-QE7X69iQI+ZXwldE+rzasvbJiyV/ju1FGHH0Qn2W3FKbuYtqp8LKcy6iSw79fVUT5/Vvf+0XgLCeYVG+UV6hOw==", + "dev": true, + "dependencies": { + "mini-svg-data-uri": "^1.2.3" + }, + "peerDependencies": { + "tailwindcss": ">=3.0.0 || >= 3.0.0-alpha.1" + } + }, "node_modules/@tailwindcss/typography": { "version": "0.5.13", "resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.13.tgz", @@ -4656,6 +4669,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/mini-svg-data-uri": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/mini-svg-data-uri/-/mini-svg-data-uri-1.4.4.tgz", + "integrity": "sha512-r9deDe9p5FJUPZAk3A59wGH7Ii9YrjjWw0jmw/liSbHl2CHiyXj6FcDXDu2K3TjVAXqiJdaw3xxwlZZr9E6nHg==", + "dev": true, + "bin": { + "mini-svg-data-uri": "cli.js" + } + }, "node_modules/minimatch": { "version": "9.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", diff --git a/package.json b/package.json index a044f25..b15d77f 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ }, "license": "GPL-3.0-or-later", "devDependencies": { + "@tailwindcss/forms": "^0.5.7", "@tailwindcss/typography": "^0.5.13" } } diff --git a/src/components/Header.astro b/src/components/Header.astro index e5702c6..d1ac4e6 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -1,31 +1,59 @@ --- interface Props {} -import { getLangFromUrl, useTranslations } from '../i18n/utils'; -import { Image } from 'astro:assets'; -import aux from '../../public/aux.svg'; +import { getLangFromUrl, useTranslations } from "../i18n/utils"; +import { Image } from "astro:assets"; +import aux from "../../public/aux.svg"; +import { languages } from "../i18n/ui"; const lang = getLangFromUrl(Astro.url); const translation = useTranslations(lang); --- -
+
+ + diff --git a/src/i18n/utils.ts b/src/i18n/utils.ts index b358317..e739594 100644 --- a/src/i18n/utils.ts +++ b/src/i18n/utils.ts @@ -6,6 +6,12 @@ export function getLangFromUrl(url: URL) { return defaultLang; } +export function switchLang(lang: keyof typeof ui) { + const parts = location.pathname.split("/"); + parts[1] = lang; + location.href = parts.join("/"); +} + export function useTranslations(lang: keyof typeof ui) { return function t(key: keyof typeof ui[typeof defaultLang]) { return ui[lang][key] || ui[defaultLang][key]; diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index bfeeabc..9c42d12 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -21,6 +21,7 @@ const lang = getLangFromUrl(Astro.url); {title} +
diff --git a/tailwind.config.mjs b/tailwind.config.mjs index 2e9b1f7..933024d 100644 --- a/tailwind.config.mjs +++ b/tailwind.config.mjs @@ -1,8 +1,11 @@ /** @type {import('tailwindcss').Config} */ export default { - content: ["./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}"], - theme: { - extend: {}, - }, - plugins: [require("@tailwindcss/typography")], + content: ["./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}"], + theme: { + extend: {}, + }, + plugins: [ + require("@tailwindcss/typography"), + require("@tailwindcss/forms"), + ], };