diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 2eede96..db1ccaa 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -1,39 +1,8 @@ import React, { useState, useEffect } from 'react'; import { Menu, X } from 'lucide-react'; import { motion, AnimatePresence } from 'framer-motion'; -import { localizePath, setLang, useLang, type Lang } from '../i18n'; - -const LANGS: Lang[] = ['pl', 'en']; - -// PL / EN toggle. Buttons rather than links: switching is a client-side -// navigation (setLang), so a real href would reload the whole document. -const LangSwitcher = ({ onSwitch }: { onSwitch?: () => void }) => { - const lang = useLang(); - - return ( -
- {LANGS.map((code, i) => ( - - {i > 0 && } - - - ))} -
- ); -}; +import { localizePath, useLang } from '../i18n'; +import LangSwitcher from './LangSwitcher'; const Header = () => { const lang = useLang(); diff --git a/src/components/LangSwitcher.tsx b/src/components/LangSwitcher.tsx new file mode 100644 index 0000000..8ea7db4 --- /dev/null +++ b/src/components/LangSwitcher.tsx @@ -0,0 +1,44 @@ +import React from 'react'; +import { setLang, useLang, type Lang } from '../i18n'; + +const LANGS: Lang[] = ['pl', 'en']; + +/** + * PL / EN toggle. Buttons rather than links: switching is a client-side + * navigation (setLang), so a real href would reload the whole document. + * + * Shared by the landing Header and the standalone pages' own headers — without + * it on those pages, /en/privacy and /en/platforma have no way back to Polish + * short of editing the URL. + * + * @param onSwitch runs after the language changes — used to close the mobile menu. + */ +const LangSwitcher = ({ onSwitch }: { onSwitch?: () => void }) => { + const lang = useLang(); + + return ( +
+ {LANGS.map((code, i) => ( + + {i > 0 && } + + + ))} +
+ ); +}; + +export default LangSwitcher; diff --git a/src/components/PlatformPage.tsx b/src/components/PlatformPage.tsx index 3e8076f..e2da998 100644 --- a/src/components/PlatformPage.tsx +++ b/src/components/PlatformPage.tsx @@ -2,6 +2,7 @@ import React from 'react'; import { ArrowRight, Building2, CheckCircle2, ChevronRight, Home } from 'lucide-react'; import Footer from './Footer'; import { localizePath, useLang } from '../i18n'; +import LangSwitcher from './LangSwitcher'; // Standalone product page at /platforma (and /en/platforma). The copy is not // localized yet — the site only translates contact.* and privacy.* — but the @@ -16,9 +17,12 @@ const PlatformPage = () => { humanAI - - ← Wróć na stronę główną - +
+ + ← Wróć na stronę główną + + +
diff --git a/src/components/PrivacyPolicyPage.tsx b/src/components/PrivacyPolicyPage.tsx index 240f83e..5de2e1f 100644 --- a/src/components/PrivacyPolicyPage.tsx +++ b/src/components/PrivacyPolicyPage.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { localizePath, useLang, useT } from '../i18n'; import Footer from './Footer'; +import LangSwitcher from './LangSwitcher'; const PrivacyPolicyPage = () => { const t = useT(); @@ -14,9 +15,12 @@ const PrivacyPolicyPage = () => { humanAI - - {t.privacy.backToHome} - +
+ + {t.privacy.backToHome} + + +