Skip to content

Commit ce6a8e3

Browse files
committed
feat(dashboard): add back button support to dynamic pages
1 parent 99f9fbe commit ce6a8e3

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

src/components/pages/dynamic-page.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,29 @@ export function DynamicPage({
2323
}: Props) {
2424
return (
2525
<div>
26+
{page.showBack && (
27+
<button
28+
type="button"
29+
onClick={() => window.history.back()}
30+
className="mb-2 flex items-center gap-1 text-sm text-(--muted-foreground) hover:text-(--foreground) transition-colors"
31+
>
32+
<svg
33+
className="h-4 w-4"
34+
fill="none"
35+
viewBox="0 0 24 24"
36+
strokeWidth={2}
37+
stroke="currentColor"
38+
aria-hidden="true"
39+
>
40+
<path
41+
strokeLinecap="round"
42+
strokeLinejoin="round"
43+
d="M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"
44+
/>
45+
</svg>
46+
Back
47+
</button>
48+
)}
2649
<h1 className="text-2xl font-bold">{page.title}</h1>
2750

2851
<div

src/lib/types/manifest.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export interface PageDefinition {
3535
layout: "default" | "full-width" | "split";
3636
sections: PageSection[];
3737
requiredPermission?: string;
38+
showBack?: boolean;
3839
}
3940

4041
export type JsonValue =

0 commit comments

Comments
 (0)