source: src/components/nav-section/mini/styles.ts@ 5d6f37a

main
Last change on this file since 5d6f37a was 5d6f37a, checked in by Naum Shapkarovski <naumshapkarovski@…>, 7 weeks ago

add customer

  • Property mode set to 100644
File size: 2.2 KB
Line 
1// @mui
2import { alpha, styled } from '@mui/material/styles';
3import ListItemIcon from '@mui/material/ListItemIcon';
4import ListItemButton from '@mui/material/ListItemButton';
5//
6import { NavItemProps, NavConfigProps } from '../types';
7
8// ----------------------------------------------------------------------
9
10type StyledItemProps = Omit<NavItemProps, 'item'> & {
11 config: NavConfigProps;
12};
13
14export const StyledItem = styled(ListItemButton, {
15 shouldForwardProp: (prop) => prop !== 'active',
16})<StyledItemProps>(({ active, open, depth, config, theme }) => {
17 const subItem = depth !== 1;
18
19 const activeStyles = {
20 root: {
21 color:
22 theme.palette.mode === 'light' ? theme.palette.primary.main : theme.palette.primary.light,
23 backgroundColor: alpha(theme.palette.primary.main, 0.08),
24 '&:hover': {
25 backgroundColor: alpha(theme.palette.primary.main, 0.16),
26 },
27 },
28 sub: {
29 color: theme.palette.text.primary,
30 backgroundColor: theme.palette.action.selected,
31 '&:hover': {
32 backgroundColor: theme.palette.action.hover,
33 },
34 },
35 };
36
37 return {
38 // Root item
39 flexDirection: 'column',
40 justifyContent: 'center',
41 borderRadius: config.itemRadius,
42 minHeight: config.itemRootHeight,
43 color: theme.palette.text.secondary,
44 margin: `0 ${config.itemGap}px ${config.itemGap}px ${config.itemGap}px`,
45 ...(config.hiddenLabel &&
46 !subItem && {
47 padding: config.itemPadding,
48 }),
49
50 // Active root item
51 ...(active && {
52 ...activeStyles.root,
53 }),
54
55 // Sub item
56 ...(subItem && {
57 margin: 0,
58 flexDirection: 'row',
59 padding: theme.spacing(0, 1),
60 minHeight: config.itemSubHeight,
61 // Active sub item
62 ...(active && {
63 ...activeStyles.sub,
64 }),
65 }),
66
67 // Open
68 ...(open &&
69 !active && {
70 color: theme.palette.text.primary,
71 backgroundColor: theme.palette.action.hover,
72 }),
73 };
74});
75
76// ----------------------------------------------------------------------
77
78type StyledIconProps = {
79 size?: number;
80};
81
82export const StyledIcon = styled(ListItemIcon)<StyledIconProps>(({ size }) => ({
83 width: size,
84 height: size,
85 marginRight: 0,
86}));
Note: See TracBrowser for help on using the repository browser.