Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtemkaDev committed Jun 14, 2024
1 parent d4bb202 commit 1c535e9
Showing 1 changed file with 55 additions and 21 deletions.
76 changes: 55 additions & 21 deletions src/components/navigation/MobileNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import LanguageSwitcher from "../language/LanguageSwitcher";
import Image from "next/image";
import { Murecho } from "next/font/google";
import { useTranslations } from "next-intl";
import { usePathname } from "next/navigation";
import Link from "next/link";

const murecho = Murecho({ subsets: ["latin", "cyrillic"] });

Expand All @@ -13,13 +15,21 @@ export default function MobileNavigation() {
const [mainComponentHeight, setMainComponentHeight] = useState(0);
const mainComponentRef = useRef(null);

const pathname = usePathname();
const lang = pathname.substring(1, 3);

function toggle() {
setShowMe(!showMe);
}
function close() {
setTimeout(() => {
setShowMe(false);
}, 300);
}

useEffect(() => {
if (mainComponentRef.current) {
let component = mainComponentRef.current as any
let component = mainComponentRef.current as any;
setMainComponentHeight(component.offsetHeight);
}
}, []);
Expand All @@ -30,13 +40,15 @@ export default function MobileNavigation() {
ref={mainComponentRef}
className={`flex flex-column bg-white justify-between items-center ${styles.mainComponent}`}
>
<Image
src="/menu/logo.png"
width={6}
height={3}
alt="AploCoin logo"
className={styles.logo}
/>
<Link href={`/${lang}`} onClick={close}>
<Image
src="/menu/logo.png"
width={6}
height={3}
alt="AploCoin logo"
className={styles.logo}
/>
</Link>
<div className="flex flex-column">
<LanguageSwitcher />
<button onClick={toggle}>
Expand All @@ -62,32 +74,54 @@ export default function MobileNavigation() {
}}
className={styles.menuPopup}
>
<a className={`${styles["url-button"]} ${murecho.className}`}>
<Link
href={`/${lang}/what-is-aplo`}
className={`${styles["url-button"]} ${murecho.className}`}
onClick={close}
>
{t("whatIsAplo")}
</a>
</Link>
<div className={styles.border} />
<a className={`${styles["url-button"]} ${murecho.className}`}>
<Link
href={`/${lang}/mining-aplo`}
className={`${styles["url-button"]} ${murecho.className}`}
onClick={close}
>
{t("mining")}
</a>
</Link>
<div className={styles.border} />
<a className={`${styles["url-button"]} ${murecho.className}`}>
<Link
href={`/${lang}/faq`}
className={`${styles["url-button"]} ${murecho.className}`}
onClick={close}
>
{t("faq")}
</a>
</Link>
<div className={styles.border} />
<a className={`${styles["url-button"]} ${murecho.className}`}>
<Link
href={`/${lang}/about-aplo`}
className={`${styles["url-button"]} ${murecho.className}`}
onClick={close}
>
{t("about")}
</a>
</Link>
<div className={styles.border} />
<a className={`${styles["url-button"]} ${murecho.className}`}>
<Link
href={`/${lang}/roadmap`}
className={`${styles["url-button"]} ${murecho.className}`}
onClick={close}
>
{t("roadmap")}
</a>
</Link>
<div className={styles.border} />
<a
<Link
href={`/${lang}/user-guides`}
className={`${styles["url-button"]} ${murecho.className}`}
onClick={close}
style={{ marginRight: "0px" }}
>
{t("userGuides")}
</a>
<div className={styles.border} />
</Link>
</div>
</>
);
Expand Down

0 comments on commit 1c535e9

Please sign in to comment.