diff --git a/frontend/Site/src/app/components/common/icon.ts b/frontend/Site/src/app/components/common/icon.ts index 98c674c2..aa7f4f34 100644 --- a/frontend/Site/src/app/components/common/icon.ts +++ b/frontend/Site/src/app/components/common/icon.ts @@ -17,7 +17,8 @@ import { FaAnglesLeft, FaAnglesRight, FaAngleDown, - FaRegCircleXmark + FaRegCircleXmark, + FaCheck } from "react-icons/fa6"; @@ -40,3 +41,4 @@ import { export const AnglesRightIcon = FaAnglesRight; export const ArrowDownIcon = FaAngleDown ; export const CircleXMarkIcon = FaRegCircleXmark; + export const TickIcon = FaCheck; diff --git a/frontend/Site/src/app/components/language/LanguageSwitcher.css b/frontend/Site/src/app/components/language/LanguageSwitcher.css new file mode 100644 index 00000000..871a88cb --- /dev/null +++ b/frontend/Site/src/app/components/language/LanguageSwitcher.css @@ -0,0 +1,87 @@ +.custom-toggle { + color: var(--typography-color-primary-invert) !important; + font: var(--typography-regular-large-body); + height: 31px; +} + +.custom-toggle:first-child:active { + border-color: transparent !important; +} + +.custom-menu { + border-radius: var(--surface-border-radius-medium) !important; + padding: var(--layout-padding-medium) 0px var(--layout-padding-medium) 0px !important; + gap: 16px; + width: 272px; + height: 370px; + box-shadow: var(--shadow-medium); + background-color: var(--surface-background-white) !important; +} + +.custom-item { + padding: var(--layout-padding-small) var(--layout-padding-medium) var(--layout-padding-small) var(--layout-padding-medium) !important; + gap: var(--layout-margin-medium); + color: var(--typography-color-primary) !important; + height: 43px; + width: 272px !important; + font: var(--typography-regular-body); +} + +.custom-item:hover { + background-color: var(--surface-secondary-hover) !important; +} + +.custom-item-first-child { + padding: var(--layout-padding-small) var(--layout-padding-medium) var(--layout-padding-small) var(--layout-padding-medium) !important; + gap: var(--layout-margin-medium); + width: 272px !important; + height: 43px; +} + +.custom-item-first-child:hover { + background-color: var(--surface-secondary-hover) !important; +} + +.custom-item-label { + font: var(--typography-regular-label); + color: var(--typography-color-secondary) !important; + height: 21px; +} + +/* .custom-item:active {background-color: #EDEBE9 !important;} +.custom-item-first-child:active {background-color: #EDEBE9 !important;} */ + +.tick-icon { + color: var(--icons-icons-primary); + width: 14px; + height: 27px; + float: right; +} + +@media screen and (max-width: 767px){ + .custom-menu { + border-radius: 0px 0px var(--surface-border-radius-medium) var(--surface-border-radius-medium) !important; + padding: var(--layout-padding-large) !important; + gap: 16px; + width: 320px; + height: 498px; + box-shadow: var(--shadow-medium); + background-color: var(--surface-background-white) !important; + } + + .custom-item { + padding: var(--layout-padding-medium) 0px var(--layout-padding-medium) 0px !important; + gap: var(--layout-margin-medium); + color: var(--typography-color-primary) !important; + height: 59px; + width: 272px !important; + font: var(--typography-regular-body); + } + + .custom-item-first-child { + padding: var(--layout-padding-medium) 0px var(--layout-padding-medium) 0px !important; + gap: var(--layout-margin-medium); + width: 272px !important; + + } +} \ No newline at end of file diff --git a/frontend/Site/src/app/components/language/LanguageSwitcher.tsx b/frontend/Site/src/app/components/language/LanguageSwitcher.tsx new file mode 100644 index 00000000..6dbcbae4 --- /dev/null +++ b/frontend/Site/src/app/components/language/LanguageSwitcher.tsx @@ -0,0 +1,109 @@ +import { useState } from "react"; +import Dropdown from "react-bootstrap/Dropdown"; +import "./LanguageSwitcher.css"; +import { TickIcon } from "../common/icon"; + +const LanguageSwitcher = () => { + // Define available languages + const LANGUAGE = [ + { + key: "ar", + value: "العربية (Arabic)", + }, + { + key: "zh-CN", + value: "简体字 (Chinese - Simplified)", + }, + { + key: "en", + value: "English", + }, + { + key: "es", + value: "Español (Spanish)", + }, + { + key: "fr", + value: "Français (French)", + }, + { + key: "it", + value: "Italiano (Italian)", + }, + { + key: "ru", + value: "Pусский (Russian)", + }, + ]; + + // Initialize current language state with English as default + const [currentLanguage, setCurrentLanguage] = useState("en"); + + // const { i18n } = useTranslation(); + // const currentLanguage = i18n.language || 'en'; + + // Function to handle language change + const changeLanguage = (lng: string) => { + setCurrentLanguage(lng); + // i18n.changeLanguage(lng); + }; + + return ( + <> + {/* Dropdown component for language selection */} + + {/* Dropdown toggle button */} + + {/* Display current selected language */} + {currentLanguage.toUpperCase()} + + + {/* Dropdown menu */} + + {/* Language options */} +
+ {/* Default option */} + +
Please select a language:
+
+
+ + {/* Map through available languages */} + {LANGUAGE && + LANGUAGE.map((lang) => ( + changeLanguage(lang.key)} + className="custom-item" + role="menuitem" + aria-label={lang.value} + aria-current={currentLanguage === lang.key ? "true" : undefined} + > + {/* Display language name */} + {lang.value} + + {/* Display tick icon if current language is selected */} + {currentLanguage === lang.key && ( + + )} + + ))} +
+
+ + ); +}; + +export default LanguageSwitcher; diff --git a/frontend/Site/src/app/components/navigation/Header.tsx b/frontend/Site/src/app/components/navigation/Header.tsx index 28271584..8c9dbb40 100644 --- a/frontend/Site/src/app/components/navigation/Header.tsx +++ b/frontend/Site/src/app/components/navigation/Header.tsx @@ -7,6 +7,7 @@ import { BarsIcon } from "../common/icon"; import { useState } from "react"; import MobileNavMenu from "./MobileNavMenu"; import { ArrowDownIcon } from "../common/icon"; +import LanguageSwitcher from "../language/LanguageSwitcher"; const Header = () => { @@ -26,8 +27,7 @@ const Header = () => {

SITE

-
EN
- +