diff --git a/inertia/components/common/navigation/back_to_dashboard.tsx b/inertia/components/common/navigation/back_to_dashboard.tsx index e88d5cd..56bd574 100644 --- a/inertia/components/common/navigation/back_to_dashboard.tsx +++ b/inertia/components/common/navigation/back_to_dashboard.tsx @@ -1,17 +1,24 @@ import { router } from '@inertiajs/react'; import { route } from '@izzyjs/route/client'; -import { ReactNode } from 'react'; +import { PropsWithChildren } from 'react'; import useSearchParam from '~/hooks/use_search_param'; import useShortcut from '~/hooks/use_shortcut'; import { appendCollectionId } from '~/lib/navigation'; -export default function BackToDashboard({ children }: { children: ReactNode }) { +interface BackToDashboardProps extends PropsWithChildren { + disabled?: boolean; +} + +export default function BackToDashboard({ + disabled = false, + children, +}: BackToDashboardProps) { const collectionId = Number(useSearchParam('collectionId')); useShortcut( 'ESCAPE_KEY', () => router.visit(appendCollectionId(route('dashboard').url, collectionId)), - { disableGlobalCheck: true } + { disableGlobalCheck: true, enabled: !disabled } ); return <>{children}; } diff --git a/inertia/mantine/components/form/mantine_form_collection.tsx b/inertia/mantine/components/form/mantine_form_collection.tsx index 13a65e4..a3c8fe6 100644 --- a/inertia/mantine/components/form/mantine_form_collection.tsx +++ b/inertia/mantine/components/form/mantine_form_collection.tsx @@ -42,7 +42,7 @@ export default function MantineFormCollection({ return ( - + - + ( + {children} +); + +export { LayoutWrapper as MantineDashboardLayout }; diff --git a/inertia/mantine/layouts/mantine_form_layout.tsx b/inertia/mantine/layouts/mantine_form_layout.tsx index 656aeb3..4c87a20 100644 --- a/inertia/mantine/layouts/mantine_form_layout.tsx +++ b/inertia/mantine/layouts/mantine_form_layout.tsx @@ -58,7 +58,7 @@ function MantineFormLayout({ width: rem(600), }} > - + <Title order={1} size="h2" c="blue"> {title} {children}