diff --git a/src/components/LangSelect/LangSelect.css b/src/components/LangSelect/LangSelect.css deleted file mode 100644 index 94ddc14..0000000 --- a/src/components/LangSelect/LangSelect.css +++ /dev/null @@ -1,14 +0,0 @@ -.lang-item { - margin: 8px 0px; - padding: 0px 16px; -} - -.lang-item .avatar { - width: 30px; - height: 30px; - border-radius: 35%; -} - -.lang-dropdown-container ul { - padding: 10px 0px !important; -} diff --git a/src/components/LangSelect/LangSelect.tsx b/src/components/LangSelect/LangSelect.tsx deleted file mode 100644 index 870e1e3..0000000 --- a/src/components/LangSelect/LangSelect.tsx +++ /dev/null @@ -1,74 +0,0 @@ - -import type { MenuProps } from "antd"; -import { Avatar, Dropdown } from "antd"; - -import { useMemo } from "react"; - -import { usePathname, useRouter, useSearchParams } from "next/navigation"; -import "./LangSelect.css"; - -type Locale = { - id: string; - title: string; - iconPath: string; -}; - -export const LOCALES: Locale[] = [ - { id: "ar", title: "العربية", iconPath: "/saudi-arabia.svg" }, - { id: "en", title: "English", iconPath: "/america.svg" }, -]; - -export default function LangSelect() { - const router = useRouter(); - const pathname = usePathname(); - const searchParams = useSearchParams(); - - const items: MenuProps["items"] = useMemo( - () => - LOCALES.map((_locale) => ({ - className: "lang-item", - key: _locale.id, - icon: ( - - - - ), - label: _locale.title, - })), - [] - ); - - return ( - { - router.push( - pathname - .split("/") - .map((item, index) => { - if (index === 1) { - return key; - } - return item; - }) - .join("/") + - (searchParams.toString() ? `?${searchParams.toString()}` : "") - ); - }, - }} - overlayClassName="lang-dropdown-container" - > - - - ); -}