Files
how2ice 005cf56baf
Some checks failed
No response / noResponse (push) Has been cancelled
CI / Continuous releases (push) Has been cancelled
CI / test-dev (macos-latest) (push) Has been cancelled
CI / test-dev (ubuntu-latest) (push) Has been cancelled
CI / test-dev (windows-latest) (push) Has been cancelled
Maintenance / main (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
init project
2025-12-12 14:26:25 +09:00

47 lines
1.2 KiB
TypeScript

import * as React from 'react';
import ListSubheader from '@mui/material/ListSubheader';
import type {} from '@mui/material/themeCssVarsAugmentation';
import DashboardSidebarContext from '../context/DashboardSidebarContext';
import { DRAWER_WIDTH } from '../constants';
import { getDrawerSxTransitionMixin } from '../mixins';
export interface DashboardSidebarHeaderItemProps {
children?: React.ReactNode;
}
export default function DashboardSidebarHeaderItem({
children,
}: DashboardSidebarHeaderItemProps) {
const sidebarContext = React.useContext(DashboardSidebarContext);
if (!sidebarContext) {
throw new Error('Sidebar context was used without a provider.');
}
const {
mini = false,
fullyExpanded = true,
hasDrawerTransitions,
} = sidebarContext;
return (
<ListSubheader
sx={{
fontSize: 12,
fontWeight: '600',
height: mini ? 0 : 36,
...(hasDrawerTransitions
? getDrawerSxTransitionMixin(fullyExpanded, 'height')
: {}),
px: 1.5,
py: 0,
minWidth: DRAWER_WIDTH,
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
zIndex: 2,
}}
>
{children}
</ListSubheader>
);
}