Skip to content

Commit eb652b2

Browse files
committed
feat: enhance NavbarActions with dropdown menu for creating new entries
- Replaced the direct button for creating a new diary with a dropdown menu that includes options for creating both a new diary and a new gist. - Added translations for "Create", "New diary", and "New gist" in Bengali language support.
1 parent db5b13f commit eb652b2

2 files changed

Lines changed: 38 additions & 4 deletions

File tree

src/components/Navbar/NavbarActions.tsx

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@
33
import { useTranslation } from "@/i18n/use-translation";
44

55
import { Button } from "../ui/button";
6+
import {
7+
DropdownMenu,
8+
DropdownMenuContent,
9+
DropdownMenuItem,
10+
DropdownMenuTrigger,
11+
} from "../ui/dropdown-menu";
612
import ThemeSwitcher from "./ThemeSwitcher";
713

814
import { useSession } from "@/store/session.atom";
9-
import { SearchIcon } from "lucide-react";
15+
import { ChevronDown, SearchIcon } from "lucide-react";
1016
import AuthenticatedUserMenu from "./AuthenticatedUserMenu";
1117
import LanguageSwitcher from "./LanguageSwitcher";
1218
import Link from "next/link";
@@ -32,9 +38,35 @@ const NavbarActions: React.FC = () => {
3238

3339
{authSession?.session ? (
3440
<>
35-
<Button className="hidden md:block" asChild>
36-
<Link href={"/dashboard/articles/new"}>{_t("New diary")}</Link>
37-
</Button>
41+
<DropdownMenu>
42+
<DropdownMenuTrigger asChild>
43+
<Button
44+
className="hidden md:inline-flex gap-1.5 pr-2"
45+
aria-haspopup="menu"
46+
>
47+
{_t("Create")}
48+
<ChevronDown className="size-4 opacity-70" aria-hidden />
49+
</Button>
50+
</DropdownMenuTrigger>
51+
<DropdownMenuContent align="end" className="min-w-44">
52+
<DropdownMenuItem asChild>
53+
<Link
54+
className="text-foreground cursor-pointer block"
55+
href="/dashboard/articles/new"
56+
>
57+
{_t("New diary")}
58+
</Link>
59+
</DropdownMenuItem>
60+
<DropdownMenuItem asChild>
61+
<Link
62+
className="text-foreground cursor-pointer block"
63+
href="/gists/new"
64+
>
65+
{_t("New gist")}
66+
</Link>
67+
</DropdownMenuItem>
68+
</DropdownMenuContent>
69+
</DropdownMenu>
3870
<AuthenticatedUserMenu />
3971
</>
4072
) : (

src/i18n/bn.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
"All tags": "সকল ট্যাগ",
2424
"Home": "বাড়ি",
2525
"Bookmarks": "বুকমার্ক",
26+
"Create": "তৈরি করুন",
2627
"New diary": "নতুন ডায়েরি",
28+
"New gist": "নতুন গিস্ট",
2729
"Dashboard": "ড্যাসবোর্ড",
2830
"Profile": "প্রোফাইল",
2931
"Profile Settings": "প্রোফাইল সেটিংস",

0 commit comments

Comments
 (0)