Skip to content

Commit c087a37

Browse files
committed
feat: add creation menu dropdown in navbar
- add creation menu dropdown in header - update app to use urls defined in siteconfig eveyrwhere
1 parent bea74ff commit c087a37

File tree

5 files changed

+89
-21
lines changed

5 files changed

+89
-21
lines changed

components/blueprints/buttons.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Button } from "@/components/ui/button";
2+
import { siteConfig } from "@/configs/site";
23
import Link from "next/link";
34
import React from "react";
45

@@ -8,7 +9,7 @@ export const CreateBlueprintButton = () => {
89
className="hover:text-white rounded-sm bg-white text-black border border-slate-300"
910
asChild
1011
>
11-
<Link href="/blueprints/new">Create blueprint</Link>
12+
<Link href={siteConfig.links.createBlueprint}>Create blueprint</Link>
1213
</Button>
1314
);
1415
};

components/collections/buttons.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ import {
1515
} from "@/components/ui/alert-dialog";
1616
import React from "react";
1717
import { useDeleteCollection } from "@/collections/hooks";
18+
import { siteConfig } from "@/configs/site";
1819

1920
export const CreateCollectionButton = () => {
2021
return (
2122
<Button
2223
className="hover:text-white rounded-sm bg-white text-black border border-slate-300"
2324
asChild
2425
>
25-
<Link href="/collections/create">Create collection</Link>
26+
<Link href={siteConfig.links.createCollection}>Create collection</Link>
2627
</Button>
2728
);
2829
};

components/global/mobile-nav.tsx

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ import {
66
MenubarItem,
77
MenubarMenu,
88
MenubarSeparator,
9-
MenubarSub,
10-
MenubarSubContent,
11-
MenubarSubTrigger,
129
MenubarTrigger,
1310
} from "@/components/ui/menubar";
1411
import { WalletProfile } from "@/components/wallet-profile";
@@ -37,12 +34,26 @@ const MobileNav = () => {
3734
<Link href={siteConfig.links.explore} className="w-full h-full">
3835
<MenubarItem>Explore</MenubarItem>
3936
</Link>
37+
<MenubarSeparator />
4038
<Link
39+
key={siteConfig.links.createHypercert}
4140
href={siteConfig.links.createHypercert}
42-
className="w-full h-full"
4341
>
44-
<MenubarItem>New hypercert</MenubarItem>
42+
<MenubarItem>Create hypercert</MenubarItem>
43+
</Link>
44+
<Link
45+
key={siteConfig.links.createCollection}
46+
href={siteConfig.links.createCollection}
47+
>
48+
<MenubarItem>Create collection</MenubarItem>
4549
</Link>
50+
<Link
51+
key={siteConfig.links.createBlueprint}
52+
href={siteConfig.links.createBlueprint}
53+
>
54+
<MenubarItem>Create blueprint</MenubarItem>
55+
</Link>
56+
<MenubarSeparator />
4657
{address && (
4758
<Link
4859
key={siteConfig.links.profile}

components/global/navbar.tsx

Lines changed: 65 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import { ArrowUpRight } from "lucide-react";
3+
import { ArrowUpRight, ChevronDown } from "lucide-react";
44

55
import ChainDisplay from "@/components/chain-display";
66
import { buttonVariants } from "@/components/ui/button";
@@ -17,6 +17,12 @@ import {
1717
TooltipTrigger,
1818
} from "@/components/ui/tooltip";
1919
import { useMediaQuery } from "@/hooks/use-media-query";
20+
import {
21+
DropdownMenu,
22+
DropdownMenuContent,
23+
DropdownMenuTrigger,
24+
DropdownMenuItem,
25+
} from "../ui/dropdown-menu";
2026

2127
const Navbar = () => {
2228
const currentPath = usePathname();
@@ -57,17 +63,64 @@ const Navbar = () => {
5763
>
5864
<span className="hover:underline">Explore</span>
5965
</Link>
60-
<Link
61-
key={siteConfig.links.createHypercert}
62-
href={siteConfig.links.createHypercert}
63-
className={`${buttonVariants({ variant: "link" })} text-lg ${
64-
currentPath === siteConfig.links.createHypercert
65-
? "opacity-1 font-semibold hover:opacity-100"
66-
: "opacity-70 hover:opacity-100"
67-
}`}
68-
>
69-
<span className="hover:underline">Create</span>
70-
</Link>
66+
67+
<DropdownMenu>
68+
<DropdownMenuTrigger className="outline-none">
69+
<span
70+
className={`${buttonVariants({ variant: "link" })} text-lg ${
71+
currentPath === siteConfig.links.createHypercert
72+
? "opacity-1 font-semibold hover:opacity-100"
73+
: "opacity-70 hover:opacity-100"
74+
} text-sm opacity-70 hover:opacity-100`}
75+
>
76+
Create <ChevronDown size={16} className="ml-2" />
77+
</span>
78+
</DropdownMenuTrigger>
79+
<DropdownMenuContent
80+
align="start"
81+
className="flex flex-col items-start"
82+
>
83+
<DropdownMenuItem asChild>
84+
<Link
85+
key={siteConfig.links.createHypercert}
86+
href={siteConfig.links.createHypercert}
87+
className={`${buttonVariants({ variant: "link" })} text-lg ${
88+
currentPath === siteConfig.links.createHypercert
89+
? "opacity-1 font-semibold hover:opacity-100"
90+
: "opacity-70 hover:opacity-100"
91+
}`}
92+
>
93+
<span className="hover:underline">New Hypercert</span>
94+
</Link>
95+
</DropdownMenuItem>
96+
<DropdownMenuItem asChild>
97+
<Link
98+
key={siteConfig.links.createCollection}
99+
href={siteConfig.links.createCollection}
100+
className={`${buttonVariants({ variant: "link" })} text-lg ${
101+
currentPath === siteConfig.links.createCollection
102+
? "opacity-1 font-semibold hover:opacity-100"
103+
: "opacity-70 hover:opacity-100"
104+
}`}
105+
>
106+
<span className="hover:underline">New Collection</span>
107+
</Link>
108+
</DropdownMenuItem>
109+
<DropdownMenuItem asChild>
110+
<Link
111+
key={siteConfig.links.createBlueprint}
112+
href={siteConfig.links.createBlueprint}
113+
className={`${buttonVariants({ variant: "link" })} text-lg ${
114+
currentPath === siteConfig.links.createBlueprint
115+
? "opacity-1 font-semibold hover:opacity-100"
116+
: "opacity-70 hover:opacity-100"
117+
}`}
118+
>
119+
<span className="hover:underline">New Blueprint</span>
120+
</Link>
121+
</DropdownMenuItem>
122+
</DropdownMenuContent>
123+
</DropdownMenu>
71124

72125
{address ? (
73126
<Link

configs/site.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ interface SiteConfig {
99
github: string;
1010
docs: string;
1111
createHypercert: string;
12-
createHyperboard: string;
12+
createCollection: string;
13+
createBlueprint: string;
1314
explore: string;
1415
evaluators: string;
1516
profile: string;
@@ -29,7 +30,8 @@ export const siteConfig: SiteConfig = {
2930
github: "https://github.com/hypercerts-org/",
3031
docs: "https://hypercerts.org/docs/",
3132
createHypercert: "/hypercerts/new",
32-
createHyperboard: "/hyperboards/new",
33+
createCollection: "/collections/create",
34+
createBlueprint: "/blueprints/new",
3335
explore: "/explore",
3436
evaluators: "/evaluators",
3537
settings: "/settings",

0 commit comments

Comments
 (0)