Skip to content

Commit d54ded1

Browse files
committed
feat: 添加全局GlobalSider
1 parent 81cc1cc commit d54ded1

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

src/layouts/modules/GlobalSider.tsx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import DarkModeContainer from '@/components/DarkModeContainer.tsx';
2+
import { GLOBAL_SIDER_MENU_ID } from '@/constants/app';
3+
import { ThemeContext } from '@/features/themeSchema';
4+
5+
import GlobalLogo from './GlobalLogo';
6+
7+
interface Props {
8+
headerHeight: number;
9+
inverted: boolean;
10+
isHorizontalMix: boolean;
11+
isVerticalMix: boolean;
12+
siderCollapse: boolean;
13+
}
14+
15+
const GlobalSider: FC<Props> = memo(({ headerHeight, inverted, isHorizontalMix, isVerticalMix, siderCollapse }) => {
16+
const { darkMode } = useContext(ThemeContext);
17+
18+
const showLogo = !isVerticalMix && !isHorizontalMix;
19+
20+
const darkMenu = !darkMode && !isHorizontalMix && inverted;
21+
22+
return (
23+
<DarkModeContainer
24+
className="size-full flex-col-stretch shadow-sider"
25+
inverted={darkMenu}
26+
>
27+
{showLogo && (
28+
<GlobalLogo
29+
showTitle={!siderCollapse}
30+
style={{ height: `${headerHeight}px` }}
31+
/>
32+
)}
33+
<div
34+
className={showLogo ? 'flex-1-hidden' : 'h-full'}
35+
id={GLOBAL_SIDER_MENU_ID}
36+
/>
37+
</DarkModeContainer>
38+
);
39+
});
40+
41+
export default GlobalSider;

0 commit comments

Comments
 (0)