Skip to content

Commit

Permalink
feat(frontend): Add back button in mobile nav
Browse files Browse the repository at this point in the history
  • Loading branch information
aXenDeveloper committed Feb 29, 2024
1 parent 22b36d1 commit 9a1ecdf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion frontend/langs/en/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"remove": "Remove color"
},
"mobile_nav": {
"home": "Home",
"back": "Back",
"notifications": "Notifications",
"messages": "Messages",
"search": "Search",
Expand Down
2 changes: 1 addition & 1 deletion frontend/langs/pl/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"remove": "Usuń kolor"
},
"mobile_nav": {
"home": "Główna",
"back": "Wróć",
"notifications": "Powiadomienia",
"messages": "Wiadomości",
"search": "Szukaj",
Expand Down
15 changes: 9 additions & 6 deletions frontend/themes/1/core/layout/quick-menu/quick-menu.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"use client";

import { Bell, Home, Mail, Menu, Search } from "lucide-react";
import { ArrowLeft, Bell, Mail, Menu, Search } from "lucide-react";
import { useTranslations } from "next-intl";

import { ItemQuickMenu } from "./item";
import { usePathname } from "@/i18n";
import { usePathname, useRouter } from "@/i18n";
import { useSession } from "@/hooks/core/use-session";
import { Drawer, DrawerContent, DrawerTrigger } from "@/components/ui/drawer";
import { DrawerQuickMenu } from "./drawer/drawer";
Expand All @@ -13,14 +13,17 @@ import { AvatarUser } from "@/components/user/avatar/avatar-user";
export const QuickMenu = () => {
const t = useTranslations("core.mobile_nav");
const pathname = usePathname();
const { back } = useRouter();
const { session } = useSession();

return (
<div className="supports-backdrop-blur:bg-background/60 fixed bottom-0 z-50 w-full border-t bg-card/75 backdrop-blur sm:hidden flex">
<ItemQuickMenu active={pathname === "/"} href="/">
<Home />
<span>{t("home")}</span>
</ItemQuickMenu>
{pathname !== "/" && (
<ItemQuickMenu onClick={back}>
<ArrowLeft />
<span>{t("back")}</span>
</ItemQuickMenu>
)}

<ItemQuickMenu href="/search" active={pathname.startsWith("/search")}>
<Search />
Expand Down

0 comments on commit 9a1ecdf

Please sign in to comment.