refactor: rename navbar components and dimensions to sidebar for improved semantic consistency

This commit is contained in:
Firman Ramdhani
2026-06-22 16:42:32 +07:00
parent 25f3cd3b30
commit edc4e15325
3 changed files with 26 additions and 25 deletions
+4 -4
View File
@@ -139,8 +139,8 @@ export default function ShellDemo() {
</Group> </Group>
), ),
header: <MockHeader />, header: <MockHeader />,
navbarMobile: <MockMobileDrawer />, sidebarMobile: <MockMobileDrawer />,
navbar: !withDoubleSidebar ? ( sidebar: !withDoubleSidebar ? (
<Box p="md" h="100%" bg="grape.1" c="grape.9" style={{ borderRight: '1px solid var(--mantine-color-grape-3)' }}> <Box p="md" h="100%" bg="grape.1" c="grape.9" style={{ borderRight: '1px solid var(--mantine-color-grape-3)' }}>
<Text fw={700} mb="sm">Mock Standard Navbar (bg="grape.1")</Text> <Text fw={700} mb="sm">Mock Standard Navbar (bg="grape.1")</Text>
<Stack gap="xs"> <Stack gap="xs">
@@ -151,7 +151,7 @@ export default function ShellDemo() {
</Stack> </Stack>
</Box> </Box>
) : undefined, ) : undefined,
navbarRail: withDoubleSidebar ? ( sidebarRail: withDoubleSidebar ? (
<Stack align="center" gap="lg" pt="md" h="100%" bg="orange.1" c="orange.9"> <Stack align="center" gap="lg" pt="md" h="100%" bg="orange.1" c="orange.9">
<Text size="xs" fw={700} style={{ writingMode: 'vertical-rl', transform: 'rotate(180deg)' }}> <Text size="xs" fw={700} style={{ writingMode: 'vertical-rl', transform: 'rotate(180deg)' }}>
Mock Rail (bg="orange.1") Mock Rail (bg="orange.1")
@@ -161,7 +161,7 @@ export default function ShellDemo() {
<SettingsIcon size={24} /> <SettingsIcon size={24} />
</Stack> </Stack>
) : undefined, ) : undefined,
navbarPanel: withDoubleSidebar ? ( sidebarPanel: withDoubleSidebar ? (
<Box p="md" h="100%" bg="grape.1" c="grape.9" style={{ borderRight: '1px solid var(--mantine-color-grape-3)' }}> <Box p="md" h="100%" bg="grape.1" c="grape.9" style={{ borderRight: '1px solid var(--mantine-color-grape-3)' }}>
<Text fw={700} mb="sm">Mock Panel (bg="grape.1")</Text> <Text fw={700} mb="sm">Mock Panel (bg="grape.1")</Text>
<Stack gap="xs"> <Stack gap="xs">
@@ -5,11 +5,11 @@ import { CoreAppShellConfig, CoreAppShellSlots, CoreAppShellDimensions } from '.
const DEFAULT_DIMENSIONS: Required<CoreAppShellDimensions> = { const DEFAULT_DIMENSIONS: Required<CoreAppShellDimensions> = {
headerHeight: 60,
navbarWidth: 260,
navbarMiniWidth: 80,
navbarRailWidth: 54,
utilityBarHeight: 32, utilityBarHeight: 32,
headerHeight: 60,
sidebarWidth: 260,
sidebarMiniWidth: 80,
sidebarRailWidth: 54,
asideWidth: 260, asideWidth: 260,
}; };
@@ -31,12 +31,12 @@ function CoreAppShellInner({ slots, children }: CoreAppShellInnerProps) {
const navbarWidth = useMemo(() => { const navbarWidth = useMemo(() => {
if (isTopNav) return 0; if (isTopNav) return 0;
if (isDoubleSidebar) { if (isDoubleSidebar) {
return navbarPanelOpened ? dims.navbarWidth : dims.navbarRailWidth; return navbarPanelOpened ? dims.sidebarWidth : dims.sidebarRailWidth;
} }
if (sidebarVariant === 'mini' && dims.navbarMiniWidth) { if (sidebarVariant === 'mini' && dims.sidebarMiniWidth) {
return dims.navbarMiniWidth; return dims.sidebarMiniWidth;
} }
return dims.navbarWidth; return dims.sidebarWidth;
}, [sidebarVariant, dims, isTopNav, isDoubleSidebar, navbarPanelOpened]); }, [sidebarVariant, dims, isTopNav, isDoubleSidebar, navbarPanelOpened]);
// Determine AppShell Layout // Determine AppShell Layout
@@ -121,27 +121,27 @@ function CoreAppShellInner({ slots, children }: CoreAppShellInnerProps) {
{isDoubleSidebar ? ( {isDoubleSidebar ? (
<Flex h="100%" direction="row" wrap="nowrap"> <Flex h="100%" direction="row" wrap="nowrap">
<Box <Box
w={dims.navbarRailWidth} w={dims.sidebarRailWidth}
h="100%" h="100%"
style={{ style={{
flexShrink: 0, flexShrink: 0,
borderRight: '1px solid var(--mantine-color-default-border)' borderRight: '1px solid var(--mantine-color-default-border)'
}} }}
> >
{slots.navbarRail} {slots.sidebarRail}
</Box> </Box>
{navbarPanelOpened && ( {navbarPanelOpened && (
<Box flex={1} h="100%" style={{ overflow: 'hidden' }}> <Box flex={1} h="100%" style={{ overflow: 'hidden' }}>
{slots.navbarPanel} {slots.sidebarPanel}
</Box> </Box>
)} )}
</Flex> </Flex>
) : ( ) : (
slots.navbar slots.sidebar
)} )}
</Box> </Box>
<Box hiddenFrom="sm" h="100%"> <Box hiddenFrom="sm" h="100%">
{slots.navbarMobile || slots.navbar} {slots.sidebarMobile || slots.sidebar}
</Box> </Box>
</AppShell.Navbar> </AppShell.Navbar>
)} )}
@@ -168,7 +168,8 @@ function CoreAppShellInner({ slots, children }: CoreAppShellInnerProps) {
{showFooter && ( {showFooter && (
<AppShell.Footer <AppShell.Footer
zIndex={isFooterOffset ? 100 : 105} // zIndex={isFooterOffset ? 100 : 105}
zIndex={100}
style={ style={
isFooterOffset isFooterOffset
? { ? {
@@ -7,9 +7,9 @@ export type DesktopCollapseVariant = 'hide' | 'mini';
export interface CoreAppShellDimensions { export interface CoreAppShellDimensions {
utilityBarHeight?: number | string; utilityBarHeight?: number | string;
headerHeight?: number | string; headerHeight?: number | string;
navbarWidth?: number | string; sidebarWidth?: number | string;
navbarMiniWidth?: number | string; sidebarMiniWidth?: number | string;
navbarRailWidth?: number | string; sidebarRailWidth?: number | string;
asideWidth?: number | string; asideWidth?: number | string;
} }
@@ -33,10 +33,10 @@ export interface CoreAppShellConfig {
export interface CoreAppShellSlots { export interface CoreAppShellSlots {
utilityBar?: ReactNode; utilityBar?: ReactNode;
header?: ReactNode; header?: ReactNode;
navbar?: ReactNode; sidebar?: ReactNode;
navbarMobile?: ReactNode; sidebarMobile?: ReactNode;
navbarRail?: ReactNode; sidebarRail?: ReactNode;
navbarPanel?: ReactNode; sidebarPanel?: ReactNode;
aside?: ReactNode; aside?: ReactNode;
footer?: ReactNode; footer?: ReactNode;
} }