Skip to content

Commit 0dcc13a

Browse files
created two button sticky layout, added action buttons to event details
1 parent 033bc88 commit 0dcc13a

2 files changed

Lines changed: 42 additions & 3 deletions

File tree

client/src/pages/events/[id].tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { useRouter } from "next/router";
22

3+
import { Button } from "@/components/ui/button";
34
import TagList from "@/components/ui/tag-list";
45
import { useEvent } from "@/hooks/event";
56

6-
import DockLayout from "../layouts/docklayout";
7+
import ActionLayout from "../layouts/actionlayout";
78

89
export default function EventDetailsPage() {
910
// useRouter allows access to URL parameters
@@ -20,7 +21,18 @@ export default function EventDetailsPage() {
2021
}
2122

2223
return (
23-
<DockLayout>
24+
<ActionLayout
25+
secondaryAction={
26+
<Button
27+
variant="outline"
28+
className="flex-1"
29+
onClick={() => router.back()}
30+
>
31+
Back
32+
</Button>
33+
}
34+
primaryAction={<Button className="flex-1">Join Event</Button>}
35+
>
2436
<div className="mx-auto max-w-3xl px-4 sm:px-6 lg:px-0">
2537
<div className="relative h-56 w-full overflow-hidden rounded-xl bg-gray-200">
2638
<div className="absolute -bottom-6 left-6">
@@ -42,6 +54,6 @@ export default function EventDetailsPage() {
4254
</div>
4355
</div>
4456
</div>
45-
</DockLayout>
57+
</ActionLayout>
4658
);
4759
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
type ActionLayoutProps = {
2+
children: React.ReactNode;
3+
4+
primaryAction?: React.ReactNode;
5+
secondaryAction?: React.ReactNode;
6+
};
7+
8+
export default function ActionLayout({
9+
children,
10+
primaryAction,
11+
secondaryAction,
12+
}: ActionLayoutProps) {
13+
return (
14+
<div className="flex min-h-screen flex-col">
15+
<main className="flex-1 px-4 py-6">{children}</main>
16+
17+
{(primaryAction || secondaryAction) && (
18+
<footer className="sticky bottom-0 border-t bg-white px-4 py-3">
19+
<div className="mx-auto flex max-w-3xl gap-3">
20+
{secondaryAction}
21+
{primaryAction}
22+
</div>
23+
</footer>
24+
)}
25+
</div>
26+
);
27+
}

0 commit comments

Comments
 (0)