diff --git a/package.json b/package.json
index cb5459b..486685c 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "estateguru-tax",
"private": true,
- "version": "1.0.2",
+ "version": "1.1.0",
"type": "module",
"scripts": {
"dev": "vite",
diff --git a/src/common/constants.ts b/src/common/constants.ts
index d8c41ba..ad6c664 100644
--- a/src/common/constants.ts
+++ b/src/common/constants.ts
@@ -13,7 +13,16 @@ const DEDUCTION_TYPES = [
'Sale fee', 'Secondary Market Loss', 'Fee'
] as const
+const LANG_CODES = ['en', 'pl'] as const
+
+const LANG_ICONS = {
+ en: '🇬🇧',
+ pl: '🇵🇱'
+} as const
+
export {
INCOME_TYPES,
- DEDUCTION_TYPES
+ DEDUCTION_TYPES,
+ LANG_CODES,
+ LANG_ICONS
}
diff --git a/src/components/LanguageSwitcher/LanguageSwitcher.test.tsx b/src/components/LanguageSwitcher/LanguageSwitcher.test.tsx
new file mode 100644
index 0000000..bc868b0
--- /dev/null
+++ b/src/components/LanguageSwitcher/LanguageSwitcher.test.tsx
@@ -0,0 +1,11 @@
+import React from 'react'
+
+import { render } from '@testing-library/react'
+
+import LanguageSwitcher from './LanguageSwitcher'
+
+describe('LanguageSwitcher', () => {
+ it('renders without error', async () => {
+ render()
+ })
+})
diff --git a/src/components/LanguageSwitcher/LanguageSwitcher.tsx b/src/components/LanguageSwitcher/LanguageSwitcher.tsx
new file mode 100644
index 0000000..1bd0e17
--- /dev/null
+++ b/src/components/LanguageSwitcher/LanguageSwitcher.tsx
@@ -0,0 +1,75 @@
+import React, { type FC, Fragment } from 'react'
+
+import { Menu, Transition } from '@headlessui/react'
+import clsx from 'clsx'
+import { useTranslation } from 'react-i18next'
+
+import { type LANG_CODES, LANG_ICONS } from 'common/constants'
+
+const Item: FC = ({ language }) => {
+ const { i18n, t } = useTranslation()
+
+ const handleClick = async (): Promise => {
+ await i18n.changeLanguage(language)
+ }
+
+ return (
+
+ {({ active }) => (
+
+ )}
+
+ )
+}
+
+interface ItemProps {
+ language: typeof LANG_CODES[number]
+}
+
+const LanguageSwitcher: FC = () => {
+ const { i18n, t } = useTranslation()
+
+ return (
+
+ )
+}
+
+export default LanguageSwitcher
diff --git a/src/components/LanguageSwitcher/index.ts b/src/components/LanguageSwitcher/index.ts
new file mode 100644
index 0000000..757a095
--- /dev/null
+++ b/src/components/LanguageSwitcher/index.ts
@@ -0,0 +1 @@
+export { default } from './LanguageSwitcher'
diff --git a/src/components/Navbar/Navbar.tsx b/src/components/Navbar/Navbar.tsx
index 0d3fb9e..423a696 100644
--- a/src/components/Navbar/Navbar.tsx
+++ b/src/components/Navbar/Navbar.tsx
@@ -6,6 +6,8 @@ import { useTranslation } from 'react-i18next'
import { GithubIcon } from 'assets/icons'
+import { LanguageSwitcher } from 'components'
+
const Navbar: FC = () => {
const { t } = useTranslation()
const [isLogoHovered, setIsLogoHovered] = useState(false)
@@ -26,14 +28,17 @@ const Navbar: FC = () => {
{t('app.name')}
-
-
-
+
diff --git a/src/components/index.ts b/src/components/index.ts
index f82edca..0555d5a 100644
--- a/src/components/index.ts
+++ b/src/components/index.ts
@@ -1,6 +1,7 @@
/* eslint-disable sort-imports, import/order */
/* PLOP_INJECT_EXPORT */
+export { default as LanguageSwitcher } from './LanguageSwitcher'
export { default as Alert } from './Alert'
export { default as Checkbox } from './Checkbox'
export { default as Faq } from './Faq'
diff --git a/src/locale/en.json b/src/locale/en.json
index 8faf608..d04ca04 100644
--- a/src/locale/en.json
+++ b/src/locale/en.json
@@ -40,5 +40,9 @@
"faq.related.answer": "No. The Estateguru Tax Calculator is not related to Estateguru. It is an independent tool created by a third party. Estateguru does not endorse the use of the Estateguru Tax Calculator, and it does not take any responsibility for the results of the calculations generated by the tool.",
"footer.disclaimer": "Results rendered by the use of this tool should be treated as suggestions and are not guaranteed to be accurate calculations of the actual Estateguru investment income, nor the amount of income tax that ought to be paid. Always consult a professional accountant. The creator of this tool takes no responsibility for the calculations generated by the Estateguru Tax Calculator.",
"footer.copyright": "© {year} Mateusz Ciszczoń/{fiLink}",
- "footer.oss": "Estateguru Tax Calculator is an open source tool. Feel free to improve it!"
+ "footer.oss": "Estateguru Tax Calculator is an open source tool. Feel free to improve it!",
+ "languageSwitcher.en.en.label": "English",
+ "languageSwitcher.en.pl.label": "Polish",
+ "languageSwitcher.pl.en.label": "angielski",
+ "languageSwitcher.pl.pl.label": "polski"
}