diff --git a/src/app/(client-components)/(Header)/LangDropdown.tsx b/src/app/(client-components)/(Header)/LangDropdown.tsx new file mode 100644 index 0000000..895ec8c --- /dev/null +++ b/src/app/(client-components)/(Header)/LangDropdown.tsx @@ -0,0 +1,184 @@ +import { Popover, Tab, Transition } from "@headlessui/react"; +import { + BanknotesIcon, + GlobeAltIcon, + ChevronDownIcon, +} from "@heroicons/react/24/outline"; +import { FC, Fragment } from "react"; +import { headerCurrency } from "./CurrencyDropdown"; + +export const headerLanguage = [ + { + id: "English", + name: "English", + description: "United State", + href: "##", + active: true, + }, + { + id: "Vietnamese", + name: "Vietnamese", + description: "Vietnamese", + href: "##", + }, + { + id: "Francais", + name: "Francais", + description: "Belgique", + href: "##", + }, + { + id: "Francais", + name: "Francais", + description: "Canada", + href: "##", + }, + { + id: "Francais", + name: "Francais", + description: "Belgique", + href: "##", + }, + { + id: "Francais", + name: "Francais", + description: "Canada", + href: "##", + }, +]; + +interface LangDropdownProps { + panelClassName?: string; + className?: string; +} + +function classNames(...classes: any) { + return classes.filter(Boolean).join(" "); +} + +const LangDropdown: FC = ({ + panelClassName = "top-full right-0 max-w-sm w-96", + className = "hidden md:flex", +}) => { + const renderLang = (close: () => void) => { + return ( +
+ {headerLanguage.map((item, index) => ( + close()} + className={`flex items-center p-2 -m-3 transition duration-150 ease-in-out rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none focus-visible:ring focus-visible:ring-orange-500 focus-visible:ring-opacity-50 ${ + item.active ? "bg-gray-100 dark:bg-gray-700" : "opacity-80" + }`} + > +
+

{item.name}

+

+ {item.description} +

+
+
+ ))} +
+ ); + }; + + const renderCurr = (close: () => void) => { + return ( +
+ {headerCurrency.map((item, index) => ( + close()} + className={`flex items-center p-2 -m-3 transition duration-150 ease-in-out rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none focus-visible:ring focus-visible:ring-orange-500 focus-visible:ring-opacity-50 ${ + item.active ? "bg-gray-100 dark:bg-gray-700" : "opacity-80" + }`} + > + +

{item.name}

+
+ ))} +
+ ); + }; + + return ( + <> + + {({ open, close }) => ( + <> + + + / + + + + +
+ + + {["Language", "Currency"].map((category) => ( + + classNames( + "w-full rounded-full py-2 text-sm font-medium leading-5 text-gray-700", + "focus:outline-none focus:ring-0", + selected + ? "bg-white shadow" + : "text-gray-700 dark:text-slate-300 hover:bg-white/70 dark:hover:bg-slate-900/40" + ) + } + > + {category} + + ))} + + + + {renderLang(close)} + + + {renderCurr(close)} + + + +
+
+
+ + )} +
+ + ); +}; +export default LangDropdown;