mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-09 03:38:17 +00:00
enhance onNavigate prop to accept options for navigation state
This commit is contained in:
@@ -53,7 +53,12 @@ export interface AppLayoutProps {
|
|||||||
title?: string;
|
title?: string;
|
||||||
sidebarItems: SidebarItem[];
|
sidebarItems: SidebarItem[];
|
||||||
activeHref?: string;
|
activeHref?: string;
|
||||||
onNavigate?: (href: string) => void;
|
/**
|
||||||
|
* Navigate to a route. Accepts an optional options object (e.g. `{ state }`)
|
||||||
|
* forwarded to the router — used to pass navigation state like `fresh: true`
|
||||||
|
* to the new-booking wizard. Compatible with react-router's `navigate`.
|
||||||
|
*/
|
||||||
|
onNavigate?: (href: string, options?: { state?: unknown }) => void;
|
||||||
enableThemeToggle?: boolean;
|
enableThemeToggle?: boolean;
|
||||||
userName?: string;
|
userName?: string;
|
||||||
userEmail?: string;
|
userEmail?: string;
|
||||||
@@ -157,7 +162,8 @@ export function AppLayout({
|
|||||||
const primaryDarkColor = theme.colors["edr-green"][7];
|
const primaryDarkColor = theme.colors["edr-green"][7];
|
||||||
|
|
||||||
const activePath = activeHref.toLowerCase();
|
const activePath = activeHref.toLowerCase();
|
||||||
const navigate = (href: string) => onNavigate?.(href);
|
const navigate = (href: string, options?: { state?: unknown }) =>
|
||||||
|
onNavigate?.(href, options);
|
||||||
|
|
||||||
const toggleTheme = () => {
|
const toggleTheme = () => {
|
||||||
setColorScheme(computedColorScheme === "dark" ? "light" : "dark");
|
setColorScheme(computedColorScheme === "dark" ? "light" : "dark");
|
||||||
|
|||||||
Reference in New Issue
Block a user