Added tooltips to buttons in collapsed view
This commit is contained in:
1 parent
c20600d102
commit
1c31b13438
1 file changed
+51
@@ -184,6 +184,22 @@ function Sidebar() {
|
|||||||
>
|
>
|
||||||
{menu.map((item) =>
|
{menu.map((item) =>
|
||||||
item.path ? (
|
item.path ? (
|
||||||
|
<Tooltip
|
||||||
|
placement="right"
|
||||||
|
title={collapsed ? item.name : ""}
|
||||||
|
slotProps={{
|
||||||
|
popper: {
|
||||||
|
modifiers: [
|
||||||
|
{
|
||||||
|
name: "offset",
|
||||||
|
options: {
|
||||||
|
offset: [0, -16],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
<ListItemButton
|
<ListItemButton
|
||||||
className={
|
className={
|
||||||
location.pathname.includes(item.path) ? "selected-path" : ""
|
location.pathname.includes(item.path) ? "selected-path" : ""
|
||||||
@@ -199,8 +215,25 @@ function Sidebar() {
|
|||||||
<ListItemIcon sx={{ minWidth: 0 }}>{item.icon}</ListItemIcon>
|
<ListItemIcon sx={{ minWidth: 0 }}>{item.icon}</ListItemIcon>
|
||||||
{!collapsed && <ListItemText>{item.name}</ListItemText>}
|
{!collapsed && <ListItemText>{item.name}</ListItemText>}
|
||||||
</ListItemButton>
|
</ListItemButton>
|
||||||
|
</Tooltip>
|
||||||
) : collapsed ? (
|
) : collapsed ? (
|
||||||
<React.Fragment key={item.name}>
|
<React.Fragment key={item.name}>
|
||||||
|
<Tooltip
|
||||||
|
placement="right"
|
||||||
|
title={collapsed ? item.name : ""}
|
||||||
|
slotProps={{
|
||||||
|
popper: {
|
||||||
|
modifiers: [
|
||||||
|
{
|
||||||
|
name: "offset",
|
||||||
|
options: {
|
||||||
|
offset: [0, -16],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
<ListItemButton
|
<ListItemButton
|
||||||
className={
|
className={
|
||||||
Boolean(anchorEl) && popup === item.name
|
Boolean(anchorEl) && popup === item.name
|
||||||
@@ -218,6 +251,7 @@ function Sidebar() {
|
|||||||
<ListItemIcon sx={{ minWidth: 0 }}>{item.icon}</ListItemIcon>
|
<ListItemIcon sx={{ minWidth: 0 }}>{item.icon}</ListItemIcon>
|
||||||
{!collapsed && <ListItemText>{item.name}</ListItemText>}
|
{!collapsed && <ListItemText>{item.name}</ListItemText>}
|
||||||
</ListItemButton>
|
</ListItemButton>
|
||||||
|
</Tooltip>
|
||||||
<Menu
|
<Menu
|
||||||
className="sidebar-popup"
|
className="sidebar-popup"
|
||||||
anchorEl={anchorEl}
|
anchorEl={anchorEl}
|
||||||
@@ -346,6 +380,22 @@ function Sidebar() {
|
|||||||
sx={{ px: collapsed ? theme.gap.xs : theme.gap.ml }}
|
sx={{ px: collapsed ? theme.gap.xs : theme.gap.ml }}
|
||||||
>
|
>
|
||||||
{other.map((item) => (
|
{other.map((item) => (
|
||||||
|
<Tooltip
|
||||||
|
placement="right"
|
||||||
|
title={collapsed ? item.name : ""}
|
||||||
|
slotProps={{
|
||||||
|
popper: {
|
||||||
|
modifiers: [
|
||||||
|
{
|
||||||
|
name: "offset",
|
||||||
|
options: {
|
||||||
|
offset: [0, -16],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
<ListItemButton
|
<ListItemButton
|
||||||
className={
|
className={
|
||||||
location.pathname.includes(item.path) ? "selected-path" : ""
|
location.pathname.includes(item.path) ? "selected-path" : ""
|
||||||
@@ -369,6 +419,7 @@ function Sidebar() {
|
|||||||
<ListItemIcon sx={{ minWidth: 0 }}>{item.icon}</ListItemIcon>
|
<ListItemIcon sx={{ minWidth: 0 }}>{item.icon}</ListItemIcon>
|
||||||
{!collapsed && <ListItemText>{item.name}</ListItemText>}
|
{!collapsed && <ListItemText>{item.name}</ListItemText>}
|
||||||
</ListItemButton>
|
</ListItemButton>
|
||||||
|
</Tooltip>
|
||||||
))}
|
))}
|
||||||
</List>
|
</List>
|
||||||
<Divider sx={{ mt: "auto" }} />
|
<Divider sx={{ mt: "auto" }} />
|
||||||
|
|||||||
Reference in new issue
Block a user