@cullsin/lnc-menu 3.0.12 → 3.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,7 @@ import RecentActorsOutlinedIcon from "@mui/icons-material/RecentActorsOutlined";
14
14
  import ArticleOutlinedIcon from "@mui/icons-material/ArticleOutlined";
15
15
  function SideMenu({ useDrawer, SampleMgmtIcon, navigate }) {
16
16
  const [selectedMainMenu, setSelectedMainMenu] = React.useState(null); // Track selected main menu
17
+ const [selectedSubMenuPath, setSelectedSubMenuPath] = React.useState(null);
17
18
  const [openMenuIndex, setOpenMenuIndex] = React.useState(null);
18
19
  const { isDrawerOpen, toggleDrawer } = useDrawer();
19
20
  const [anchorEl, setAnchorEl] = React.useState(null);
@@ -26,7 +27,8 @@ function SideMenu({ useDrawer, SampleMgmtIcon, navigate }) {
26
27
  setOpenMenuIndex(null);
27
28
  };
28
29
  const handleSubMenuItemClick = (path, parentText) => {
29
- setSelectedMainMenu(parentText); // Set the main menu selected when a submenu item is clicked
30
+ setSelectedMainMenu(parentText);
31
+ setSelectedSubMenuPath(path); // Set based on path for unique identification
30
32
  handleMenuClose();
31
33
  if (isDrawerOpen) {
32
34
  toggleDrawer();
@@ -90,6 +92,6 @@ function SideMenu({ useDrawer, SampleMgmtIcon, navigate }) {
90
92
  style: {
91
93
  marginLeft: isDrawerOpen ? 230 : 65,
92
94
  },
93
- }, children: [_jsx("span", { className: "submenu-title", children: !isDrawerOpen ? item.text : "" }), item.subMenu.map((subItem) => (_jsx(MenuItem, { onClick: () => handleSubMenuItemClick(subItem.path, item.text), children: subItem.text }, subItem.text)))] }))] }, index))) }) })] }));
95
+ }, children: [_jsx("span", { className: "submenu-title", children: !isDrawerOpen ? item.text : "" }), item.subMenu.map((subItem) => (_jsx(MenuItem, { selected: selectedSubMenuPath === subItem.path, onClick: () => handleSubMenuItemClick(subItem.path, item.text), children: subItem.text }, subItem.text)))] }))] }, index))) }) })] }));
94
96
  }
95
97
  export default SideMenu;
@@ -1,119 +1,118 @@
1
1
  //overwritten the default MUI css
2
2
 
3
3
  .MuiBox-root .MuiList-root {
4
- background: linear-gradient(to bottom, #1e2f97, #0b1659) !important;
4
+ background: linear-gradient(to bottom, #1e2f97, #0b1659) !important;
5
+ color: #fff;
6
+ height: 100%;
7
+ bottom: 0; // Ensure drawer stretches till bottom
8
+ padding: 20px 0;
9
+ }
10
+
11
+ .MuiList-root {
12
+ &.MuiMenu-list {
13
+ background: linear-gradient(to bottom, #586d81, #3e4f60) !important;
5
14
  color: #fff;
6
- height: 100%;
7
- bottom: 0; // Ensure drawer stretches till bottom
8
- padding: 20px 0;
9
- }
10
-
11
- .MuiList-root {
12
- &.MuiMenu-list {
13
- background: linear-gradient(to bottom, #586d81, #3e4f60) !important;
14
- color: #fff;
15
- width: 175px;
16
- padding: 10px;
17
- position: relative;
18
- overflow: visible;
19
-
20
- .submenu-title {
21
- text-transform: uppercase;
22
- font: 12px / 18px "OpenSans-Regular";
23
- color: #efffff;
24
- padding: 0 0 5px 10px;
25
- display: block;
15
+ width: 200px;
16
+ padding: 10px;
17
+ position: relative;
18
+ overflow: visible;
19
+
20
+ .submenu-title {
21
+ text-transform: uppercase;
22
+ font: 12px / 18px "OpenSans-Regular";
23
+ color: #efffff;
24
+ padding: 0 0 5px 10px;
25
+ display: block;
26
+ }
27
+
28
+ .MuiMenuItem-root {
29
+ &.Mui-focusVisible {
30
+ background-color: transparent;
26
31
  }
27
-
28
- .MuiMenuItem-root {
29
- &.Mui-focusVisible {
30
- background-color: transparent;
31
- }
32
-
33
- &:hover {
34
- font: 16px/24px "OpenSans-SemiBold";
35
- background: #374451;
36
- border-radius: 6px;
37
- }
32
+
33
+ &:hover {
34
+ font: 16px/24px "OpenSans-SemiBold";
35
+ background: #374451;
36
+ border-radius: 6px;
38
37
  }
39
38
  }
40
-
41
- .MuiListItem-root {
42
- padding: 15px;
43
- &.selected {
44
- padding: 7px;
45
-
46
- .MuiListItemIcon-root {
39
+ }
40
+
41
+ .MuiListItem-root {
42
+ padding: 15px;
43
+ &.selected {
44
+ padding: 7px;
45
+
46
+ .MuiListItemIcon-root {
47
+ background: linear-gradient(to bottom, #7ad4f7, #20a9ef) !important;
48
+ color: #1e2f97;
49
+ padding: 10px;
50
+ min-width: 25px;
51
+ border-top-left-radius: 5px;
52
+ border-bottom-left-radius: 5px;
53
+
54
+ &:only-of-type {
55
+ border-top-right-radius: 5px;
56
+ border-bottom-right-radius: 5px;
57
+ }
58
+ }
59
+
60
+ .MuiListItemText-root {
61
+ span {
47
62
  background: linear-gradient(to bottom, #7ad4f7, #20a9ef) !important;
48
63
  color: #1e2f97;
49
- padding: 10px;
64
+ padding: 10px 0;
50
65
  min-width: 25px;
51
- border-top-left-radius: 5px;
52
- border-bottom-left-radius: 5px;
53
-
54
- &:only-of-type {
55
- border-top-right-radius: 5px;
56
- border-bottom-right-radius: 5px;
57
- }
58
- }
59
-
60
- .MuiListItemText-root {
61
- span {
62
- background: linear-gradient(to bottom, #7ad4f7, #20a9ef) !important;
63
- color: #1e2f97;
64
- padding: 10px 0;
65
- min-width: 25px;
66
- border-top-right-radius: 5px;
67
- border-bottom-right-radius: 5px;
68
- }
66
+ border-top-right-radius: 5px;
67
+ border-bottom-right-radius: 5px;
69
68
  }
70
69
  }
71
-
72
- .MuiListItemIcon-root {
70
+ }
71
+
72
+ .MuiListItemIcon-root {
73
+ color: #fff;
74
+ min-width: 30px;
75
+ cursor: pointer;
76
+ }
77
+
78
+ .MuiListItemText-root {
79
+ margin-top: 0;
80
+ margin-bottom: 0;
81
+ .MuiTypography-root {
82
+ font: 14px/24px "OpenSans-SemiBold";
73
83
  color: #fff;
74
- min-width: 30px;
75
84
  cursor: pointer;
76
- }
77
-
78
- .MuiListItemText-root {
79
- margin-top: 0;
80
- margin-bottom: 0;
81
- .MuiTypography-root {
82
- font: 14px/24px "OpenSans-SemiBold";
83
- color: #fff;
84
- cursor: pointer;
85
- white-space: nowrap;
86
- }
87
- }
88
- }
89
- }
90
-
91
- ul.MuiList-root {
92
- &:has(.submenu-title) {
93
- &::before {
94
- content: "";
95
- position: absolute;
96
- top: 15px;
97
- left: -8px;
98
- width: 0;
99
- height: 0;
100
- border-top: 8px solid transparent;
101
- border-bottom: 8px solid transparent;
102
- border-right: 8px solid #516578;
103
- z-index: 2;
85
+ white-space: nowrap;
104
86
  }
105
87
  }
106
88
  }
107
-
108
- .MuiPopover-root {
109
- .MuiPaper-root {
110
- overflow: visible;
111
- position: relative;
112
- width: max-content;
89
+ }
90
+
91
+ ul.MuiList-root {
92
+ &:has(.submenu-title) {
93
+ &::before {
94
+ content: "";
95
+ position: absolute;
96
+ top: 15px;
97
+ left: -8px;
98
+ width: 0;
99
+ height: 0;
100
+ border-top: 8px solid transparent;
101
+ border-bottom: 8px solid transparent;
102
+ border-right: 8px solid #516578;
103
+ z-index: 2;
113
104
  }
114
105
  }
115
-
116
- .MuiList-root.MuiMenu-list {
117
- border-radius: 5px;
106
+ }
107
+
108
+ .MuiPopover-root {
109
+ .MuiPaper-root {
110
+ overflow: visible;
111
+ position: relative;
112
+ width: max-content;
118
113
  }
119
-
114
+ }
115
+
116
+ .MuiList-root.MuiMenu-list {
117
+ border-radius: 5px;
118
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cullsin/lnc-menu",
3
- "version": "3.0.12",
3
+ "version": "3.0.13",
4
4
  "description": "Reusable SideMenu component for MedGenome LNC platform using MUI",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",