I'm trying to make use of Mantine's App shell (https://mantine.dev/core/app-shell/) in React Router to have it enabled on only specific routes.
How is it possible to implement this.
Usually, to display a component I would to the following, for example:
<Route element={<SidebarLayout {...{ inactive, setInactive }} />}>
<Route path="/" element={<Main />} />
But in this case, I got way more code (based on the example in the docs) - I'm planning to add a component inside this <AppShell> Component (please look all the way down):
<AppShell
styles={{
main: {
background:
theme.colorScheme === "dark"
? theme.colors.dark[8]
: theme.colors.gray[0],
},
}}
navbarOffsetBreakpoint="sm"
asideOffsetBreakpoint="sm"
navbar={
<Navbar
p="md"
hiddenBreakpoint="sm"
hidden={!opened}
width={{ sm: 200, lg: 300 }}
>
<Text>Application navbar</Text>
</Navbar>
}
aside={
<MediaQuery smallerThan="sm" styles={{ display: "none" }}>
<Aside p="md" hiddenBreakpoint="sm" width={{ sm: 200, lg: 300 }}>
<Text>Application sidebar</Text>
</Aside>
</MediaQuery>
}
footer={
<Footer height={60} p="md">
Application footer
</Footer>
}
header={
<Header height={70} p="md">
<div
style={{ display: "flex", alignItems: "center", height: "100%" }}
>
<MediaQuery largerThan="sm" styles={{ display: "none" }}>
<Burger
opened={opened}
onClick={() => setOpened((o) => !o)}
size="sm"
color={theme.colors.gray[6]}
mr="xl"
/>
</MediaQuery>
<Text>Application header</Text>
</div>
</Header>
}
>
<Text>Resize app to see responsive navbar in action</Text> <-- PLANNING TO ADD COMPONENT HERE BASED ON ROUTE
</AppShell>
How can I integrate this whole thing in React Router?
Outletsuit your needs? reactrouter.com/docs/en/v6/components/outlet