From 97d6f22dcb44825cee908f7f4d574326485b3560 Mon Sep 17 00:00:00 2001 From: Al Murad Uzzaman Date: Thu, 16 May 2024 12:09:13 +0600 Subject: [PATCH] languageSwithcher component added --- src/layouts/helpers/LanguageSwitcher.tsx | 31 ++++++++++++ src/layouts/partials/Header.astro | 61 ++++++------------------ src/pages/[...lang]/blog/index.astro | 7 +-- 3 files changed, 49 insertions(+), 50 deletions(-) create mode 100644 src/layouts/helpers/LanguageSwitcher.tsx diff --git a/src/layouts/helpers/LanguageSwitcher.tsx b/src/layouts/helpers/LanguageSwitcher.tsx new file mode 100644 index 0000000..9f98509 --- /dev/null +++ b/src/layouts/helpers/LanguageSwitcher.tsx @@ -0,0 +1,31 @@ +import React from 'react'; + +const LanguageSwitcher = ({ lang, languages, pathname }: { lang: string; languages: string[]; pathname: string }) => { + return ( +
+ +
+ + ) +} + +export default LanguageSwitcher \ No newline at end of file diff --git a/src/layouts/partials/Header.astro b/src/layouts/partials/Header.astro index d76fe96..538370a 100755 --- a/src/layouts/partials/Header.astro +++ b/src/layouts/partials/Header.astro @@ -2,7 +2,12 @@ import Logo from "@/components/Logo.astro"; import ThemeSwitcher from "@/components/ThemeSwitcher.astro"; import config from "@/config/config.json"; -import { getLangFromUrl, languages, useTranslations } from "@/lib/utils/i18nUtils"; +import LanguageSwitcher from "@/helpers/LanguageSwitcher"; +import { + getLangFromUrl, + languages, + useTranslations, +} from "@/lib/utils/i18nUtils"; import { loadMenu } from "@/lib/utils/loadMenu"; import { getRelativeLocaleUrl } from "astro:i18n"; import { IoSearch } from "react-icons/io5"; @@ -108,7 +113,7 @@ const t = useTranslations(lang as any); class="btn btn-outline-primary btn-sm" href={navigation_button.link} > - {t('get_started')} + {t("get_started")} ) @@ -116,50 +121,6 @@ const t = useTranslations(lang as any);
- - - - { settings.search && (