Skip to content

Commit e59c896

Browse files
authored
Merge pull request #21 from T1LT/add-button
feat: add floating add recipe button
2 parents b99edf6 + 5380f51 commit e59c896

4 files changed

Lines changed: 35 additions & 3 deletions

File tree

app/(recipes)/layout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Navbar from "@/components/navbar";
2+
import FloatingAddButton from "@/components/floating-add-button";
23

34
export const metadata = {
45
openGraph: {
@@ -23,6 +24,7 @@ export default function RecipesLayout({
2324
<>
2425
<Navbar />
2526
<div className="w-full flex justify-center px-4 py-12">{children}</div>
27+
<FloatingAddButton />
2628
</>
2729
);
2830
}

app/user/layout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Navbar from "@/components/navbar";
2+
import FloatingAddButton from "@/components/floating-add-button";
23

34
export default function RecipesLayout({
45
children,
@@ -9,6 +10,7 @@ export default function RecipesLayout({
910
<>
1011
<Navbar />
1112
<div className="w-full flex justify-center px-4 py-12">{children}</div>
13+
<FloatingAddButton />
1214
</>
1315
);
1416
}

components/floating-add-button.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"use client";
2+
3+
import { Plus } from "lucide-react";
4+
import Link from "next/link";
5+
import { usePathname } from "next/navigation";
6+
7+
export default function FloatingAddButton() {
8+
const pathname = usePathname();
9+
10+
// Don't show the button on the add page
11+
if (pathname === "/add") {
12+
return null;
13+
}
14+
15+
return (
16+
<div className="fixed bottom-6 right-0 left-0 z-50 flex justify-center">
17+
<div className="max-w-5xl w-full px-4 lg:px-0 flex justify-end">
18+
<Link
19+
href="/add"
20+
className="w-14 h-14 rounded-full backdrop-filter bg-background/40 backdrop-blur border flex items-center justify-center hover:bg-background/60 transition-all duration-200 shadow-lg hover:shadow-xl"
21+
aria-label="Add new recipe"
22+
>
23+
<Plus className="h-6 w-6" />
24+
</Link>
25+
</div>
26+
</div>
27+
);
28+
}

components/sso-buttons.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ export default function SSOButtons() {
1010
return (
1111
<div className="w-full mt-4">
1212
<div className="flex items-center gap-2 mb-4">
13-
<hr className="flex-1 border-gray-300" />
14-
<span className="text-xs text-gray-500">OR</span>
15-
<hr className="flex-1 border-gray-300" />
13+
<hr className="flex-1 border-muted-foreground" />
14+
<span className="text-xs text-muted-foreground">OR</span>
15+
<hr className="flex-1 border-muted-foreground" />
1616
</div>
1717

1818
<Button

0 commit comments

Comments
 (0)