diff --git a/astro.config.mjs b/astro.config.mjs index c8da946..afc8e68 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,11 +1,12 @@ import cloudflare from "@astrojs/cloudflare"; import react from "@astrojs/react"; import { defineConfig } from "astro/config"; +import UnoCSS from "unocss/astro"; // https://astro.build/config export default defineConfig({ adapter: cloudflare(), - integrations: [react()], + integrations: [react(), UnoCSS()], i18n: { defaultLocale: "zh-cn", locales: ["en", "zh-cn", "zh-hk", "ja"], diff --git a/package.json b/package.json index f666d3c..5f7b300 100644 --- a/package.json +++ b/package.json @@ -19,11 +19,13 @@ "@types/react": "^19.2.7", "@types/react-dom": "^19.2.3", "astro": "^5.0.0", - "flag-icons": "^7.5.0", "react": "^19.2.3", "react-dom": "^19.2.3" }, "devDependencies": { - "@biomejs/biome": "2.3.8" + "@biomejs/biome": "2.3.8", + "@iconify-json/flag": "^1.2.10", + "@unocss/preset-icons": "^66.5.10", + "unocss": "^66.5.10" } } diff --git a/src/components/LanguagePicker.astro b/src/components/LanguagePicker.astro index e504e1a..0730619 100644 --- a/src/components/LanguagePicker.astro +++ b/src/components/LanguagePicker.astro @@ -1,17 +1,16 @@ --- import { languages } from "../i18n/ui"; import { getLangFromUrl, getTranslatedPath } from "../i18n/utils"; -import "flag-icons/css/flag-icons.min.css"; const lang = getLangFromUrl(Astro.url); const translatePath = getTranslatedPath(lang); // https://flagicons.lipis.dev/ const flags: Record = { - en: "fi fi-us", - "zh-cn": "fi fi-cn", - "zh-hk": "fi fi-hk", - ja: "fi fi-jp", + en: "i-flag:us-4x3", + "zh-cn": "i-flag:cn-4x3", + "zh-hk": "i-flag:hk-4x3", + ja: "i-flag:jp-4x3", }; const currentFlagClass = flags[lang]; diff --git a/uno.config.ts b/uno.config.ts new file mode 100644 index 0000000..2742b64 --- /dev/null +++ b/uno.config.ts @@ -0,0 +1,6 @@ +import { defineConfig } from "unocss"; +import presetIcons from "@unocss/preset-icons"; + +export default defineConfig({ + presets: [presetIcons()], +});