Added tooltips to buttons in collapsed view
This commit is contained in:
1 parent
c20600d102
commit
1c31b13438
1 file changed
+92
-41
@@ -184,32 +184,29 @@ function Sidebar() {
|
|||||||
>
|
>
|
||||||
{menu.map((item) =>
|
{menu.map((item) =>
|
||||||
item.path ? (
|
item.path ? (
|
||||||
<ListItemButton
|
<Tooltip
|
||||||
className={
|
placement="right"
|
||||||
location.pathname.includes(item.path) ? "selected-path" : ""
|
title={collapsed ? item.name : ""}
|
||||||
}
|
slotProps={{
|
||||||
key={item.path}
|
popper: {
|
||||||
onClick={() => navigate(`/${item.path}`)}
|
modifiers: [
|
||||||
sx={{
|
{
|
||||||
gap: theme.gap.medium,
|
name: "offset",
|
||||||
borderRadius: `${theme.shape.borderRadius}px`,
|
options: {
|
||||||
justifyContent: collapsed ? "center" : "flex-start",
|
offset: [0, -16],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ListItemIcon sx={{ minWidth: 0 }}>{item.icon}</ListItemIcon>
|
|
||||||
{!collapsed && <ListItemText>{item.name}</ListItemText>}
|
|
||||||
</ListItemButton>
|
|
||||||
) : collapsed ? (
|
|
||||||
<React.Fragment key={item.name}>
|
|
||||||
<ListItemButton
|
<ListItemButton
|
||||||
className={
|
className={
|
||||||
Boolean(anchorEl) && popup === item.name
|
location.pathname.includes(item.path) ? "selected-path" : ""
|
||||||
? "selected-path"
|
|
||||||
: ""
|
|
||||||
}
|
}
|
||||||
onClick={(event) => openPopup(event, item.name)}
|
key={item.path}
|
||||||
|
onClick={() => navigate(`/${item.path}`)}
|
||||||
sx={{
|
sx={{
|
||||||
position: "relative",
|
|
||||||
gap: theme.gap.medium,
|
gap: theme.gap.medium,
|
||||||
borderRadius: `${theme.shape.borderRadius}px`,
|
borderRadius: `${theme.shape.borderRadius}px`,
|
||||||
justifyContent: collapsed ? "center" : "flex-start",
|
justifyContent: collapsed ? "center" : "flex-start",
|
||||||
@@ -218,6 +215,43 @@ 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 ? (
|
||||||
|
<React.Fragment key={item.name}>
|
||||||
|
<Tooltip
|
||||||
|
placement="right"
|
||||||
|
title={collapsed ? item.name : ""}
|
||||||
|
slotProps={{
|
||||||
|
popper: {
|
||||||
|
modifiers: [
|
||||||
|
{
|
||||||
|
name: "offset",
|
||||||
|
options: {
|
||||||
|
offset: [0, -16],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ListItemButton
|
||||||
|
className={
|
||||||
|
Boolean(anchorEl) && popup === item.name
|
||||||
|
? "selected-path"
|
||||||
|
: ""
|
||||||
|
}
|
||||||
|
onClick={(event) => openPopup(event, item.name)}
|
||||||
|
sx={{
|
||||||
|
position: "relative",
|
||||||
|
gap: theme.gap.medium,
|
||||||
|
borderRadius: `${theme.shape.borderRadius}px`,
|
||||||
|
justifyContent: collapsed ? "center" : "flex-start",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ListItemIcon sx={{ minWidth: 0 }}>{item.icon}</ListItemIcon>
|
||||||
|
{!collapsed && <ListItemText>{item.name}</ListItemText>}
|
||||||
|
</ListItemButton>
|
||||||
|
</Tooltip>
|
||||||
<Menu
|
<Menu
|
||||||
className="sidebar-popup"
|
className="sidebar-popup"
|
||||||
anchorEl={anchorEl}
|
anchorEl={anchorEl}
|
||||||
@@ -346,29 +380,46 @@ 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) => (
|
||||||
<ListItemButton
|
<Tooltip
|
||||||
className={
|
placement="right"
|
||||||
location.pathname.includes(item.path) ? "selected-path" : ""
|
title={collapsed ? item.name : ""}
|
||||||
}
|
slotProps={{
|
||||||
key={item.path}
|
popper: {
|
||||||
onClick={() =>
|
modifiers: [
|
||||||
item.path === "support"
|
{
|
||||||
? window.open(
|
name: "offset",
|
||||||
"https://github.com/bluewave-labs/bluewave-uptime",
|
options: {
|
||||||
"_blank",
|
offset: [0, -16],
|
||||||
"noreferrer"
|
},
|
||||||
)
|
},
|
||||||
: navigate(`/${item.path}`)
|
],
|
||||||
}
|
},
|
||||||
sx={{
|
|
||||||
gap: theme.gap.medium,
|
|
||||||
borderRadius: `${theme.shape.borderRadius}px`,
|
|
||||||
justifyContent: collapsed ? "center" : "flex-start",
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ListItemIcon sx={{ minWidth: 0 }}>{item.icon}</ListItemIcon>
|
<ListItemButton
|
||||||
{!collapsed && <ListItemText>{item.name}</ListItemText>}
|
className={
|
||||||
</ListItemButton>
|
location.pathname.includes(item.path) ? "selected-path" : ""
|
||||||
|
}
|
||||||
|
key={item.path}
|
||||||
|
onClick={() =>
|
||||||
|
item.path === "support"
|
||||||
|
? window.open(
|
||||||
|
"https://github.com/bluewave-labs/bluewave-uptime",
|
||||||
|
"_blank",
|
||||||
|
"noreferrer"
|
||||||
|
)
|
||||||
|
: navigate(`/${item.path}`)
|
||||||
|
}
|
||||||
|
sx={{
|
||||||
|
gap: theme.gap.medium,
|
||||||
|
borderRadius: `${theme.shape.borderRadius}px`,
|
||||||
|
justifyContent: collapsed ? "center" : "flex-start",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ListItemIcon sx={{ minWidth: 0 }}>{item.icon}</ListItemIcon>
|
||||||
|
{!collapsed && <ListItemText>{item.name}</ListItemText>}
|
||||||
|
</ListItemButton>
|
||||||
|
</Tooltip>
|
||||||
))}
|
))}
|
||||||
</List>
|
</List>
|
||||||
<Divider sx={{ mt: "auto" }} />
|
<Divider sx={{ mt: "auto" }} />
|
||||||
|
|||||||
Reference in new issue
Block a user