Update Sidemenu #179
This commit is contained in:
4 files changed
+128
-162
No files matched your search
@@ -113,7 +113,7 @@ export const AppBar = () => {
|
|||||||
<Toolbar
|
<Toolbar
|
||||||
sx={{
|
sx={{
|
||||||
justifyContent: "space-between",
|
justifyContent: "space-between",
|
||||||
paddingLeft: "12px !important",
|
paddingLeft: "20px !important",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiHomeVariant } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiHomeVariant = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiHomeVariant}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -21,6 +21,7 @@ import IconButton from "@mui/material/IconButton";
|
|||||||
import Divider from "@mui/material/Divider";
|
import Divider from "@mui/material/Divider";
|
||||||
import MuiDrawer from "@mui/material/Drawer";
|
import MuiDrawer from "@mui/material/Drawer";
|
||||||
import ListItemText from "@mui/material/ListItemText";
|
import ListItemText from "@mui/material/ListItemText";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
import { MdiClose } from "../icons/mdiClose";
|
import { MdiClose } from "../icons/mdiClose";
|
||||||
import { MdiLogoutVariant } from "../icons/mdiLogoutVariant";
|
import { MdiLogoutVariant } from "../icons/mdiLogoutVariant";
|
||||||
@@ -33,8 +34,7 @@ import { EventEmitter as event } from "../../eventEmitter.js";
|
|||||||
|
|
||||||
import "./sidemenu.module.scss";
|
import "./sidemenu.module.scss";
|
||||||
import { useDrawerStore } from "../../utils/store/drawer";
|
import { useDrawerStore } from "../../utils/store/drawer";
|
||||||
|
import { MdiHomeVariant } from "../icons/mdiHomeVariant";
|
||||||
const drawerWidth = 320;
|
|
||||||
|
|
||||||
const DrawerHeader = styled("div")(({ theme }) => ({
|
const DrawerHeader = styled("div")(({ theme }) => ({
|
||||||
display: "flex",
|
display: "flex",
|
||||||
@@ -122,14 +122,14 @@ export const SideMenu = ({}) => {
|
|||||||
sx: {
|
sx: {
|
||||||
backgroundColor: "inherit",
|
backgroundColor: "inherit",
|
||||||
border: "none",
|
border: "none",
|
||||||
width: `4em`,
|
width: `5em`,
|
||||||
height: "100vh",
|
height: "100vh",
|
||||||
zIndex: "1",
|
zIndex: "1",
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
sx={{
|
sx={{
|
||||||
zIndex: 1,
|
zIndex: 1,
|
||||||
width: `calc(${theme.spacing(7)} + 10px)`,
|
width: `5em`,
|
||||||
background: "transparent !important ",
|
background: "transparent !important ",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -139,146 +139,69 @@ export const SideMenu = ({}) => {
|
|||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
}}
|
}}
|
||||||
></DrawerHeader>
|
></DrawerHeader>
|
||||||
{libraries.isLoading ? (
|
<div className="sidemenu-item-container">
|
||||||
<>
|
{libraries.isLoading ? (
|
||||||
<Skeleton
|
<></>
|
||||||
height="100%"
|
) : (
|
||||||
variant="rounded"
|
<>
|
||||||
width="calc(100% - 10px )"
|
<NavLink
|
||||||
sx={{ margin: "5px" }}
|
to="/home"
|
||||||
></Skeleton>
|
className="sidemenu-item small"
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<List sx={{ border: "none" }}>
|
|
||||||
<Tooltip
|
|
||||||
title="Home"
|
|
||||||
placement="right"
|
|
||||||
followCursor
|
|
||||||
arrow
|
|
||||||
>
|
>
|
||||||
<ListItem
|
<div className="sidemenu-item-icon">
|
||||||
className="sidemenu-item-container"
|
<MdiHomeVariantOutline />
|
||||||
disablePadding
|
</div>
|
||||||
sx={{
|
<Typography
|
||||||
mb: 1,
|
className="sidemenu-item-text"
|
||||||
|
variant="caption"
|
||||||
|
fontWeight={500}
|
||||||
|
style={{
|
||||||
|
width: "80%",
|
||||||
}}
|
}}
|
||||||
|
overflow="hidden"
|
||||||
|
textOverflow="ellipsis"
|
||||||
|
textAlign="center"
|
||||||
>
|
>
|
||||||
<ListItemButton
|
Home
|
||||||
component={NavLink}
|
</Typography>
|
||||||
to="/home"
|
</NavLink>
|
||||||
className="sidemenu-item"
|
|
||||||
sx={{
|
|
||||||
minHeight: 48,
|
|
||||||
justifyContent:
|
|
||||||
"center",
|
|
||||||
px: 2.5,
|
|
||||||
display: "flex",
|
|
||||||
flexDirection:
|
|
||||||
"column",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ListItemIcon
|
|
||||||
sx={{
|
|
||||||
minWidth: 0,
|
|
||||||
justifyContent:
|
|
||||||
"center",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<MdiHomeVariantOutline />
|
|
||||||
</ListItemIcon>
|
|
||||||
</ListItemButton>
|
|
||||||
</ListItem>
|
|
||||||
</Tooltip>
|
|
||||||
{libraries.data.Items.map(
|
{libraries.data.Items.map(
|
||||||
(library, index) => {
|
(lib, index) => {
|
||||||
return (
|
return (
|
||||||
<Tooltip
|
<NavLink
|
||||||
title={library.Name}
|
to={`/library/${lib.Id}`}
|
||||||
placement="right"
|
className="sidemenu-item"
|
||||||
arrow
|
|
||||||
followCursor
|
|
||||||
key={index}
|
|
||||||
sx={{
|
|
||||||
mb: 1,
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<ListItem
|
<div className="sidemenu-item-icon">
|
||||||
className="sidemenu-item-container"
|
{
|
||||||
disablePadding
|
MediaCollectionTypeIconCollection[
|
||||||
|
lib
|
||||||
|
.CollectionType
|
||||||
|
]
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<Typography
|
||||||
|
className="sidemenu-item-text"
|
||||||
|
variant="caption"
|
||||||
|
fontWeight={
|
||||||
|
500
|
||||||
|
}
|
||||||
|
style={{
|
||||||
|
width: "80%",
|
||||||
|
}}
|
||||||
|
overflow="hidden"
|
||||||
|
textOverflow="ellipsis"
|
||||||
|
textAlign="center"
|
||||||
>
|
>
|
||||||
<ListItemButton
|
{lib.Name}
|
||||||
component={
|
</Typography>
|
||||||
NavLink
|
</NavLink>
|
||||||
}
|
|
||||||
to={
|
|
||||||
"/library/" +
|
|
||||||
library.Id
|
|
||||||
}
|
|
||||||
className="sidemenu-item"
|
|
||||||
sx={{
|
|
||||||
minHeight: 48,
|
|
||||||
justifyContent:
|
|
||||||
"center",
|
|
||||||
px: 2.5,
|
|
||||||
display: "flex",
|
|
||||||
flexDirection:
|
|
||||||
"column",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ListItemIcon
|
|
||||||
sx={{
|
|
||||||
minWidth: 0,
|
|
||||||
justifyContent:
|
|
||||||
"center",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{
|
|
||||||
MediaCollectionTypeIconCollection[
|
|
||||||
library
|
|
||||||
.CollectionType
|
|
||||||
]
|
|
||||||
}
|
|
||||||
</ListItemIcon>
|
|
||||||
</ListItemButton>
|
|
||||||
</ListItem>
|
|
||||||
</Tooltip>
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
)}
|
)}
|
||||||
</List>
|
</>
|
||||||
<List sx={{ marginTop: "auto" }}>
|
)}
|
||||||
<Tooltip
|
</div>
|
||||||
title="Logout"
|
|
||||||
placement="right"
|
|
||||||
followCursor
|
|
||||||
arrow
|
|
||||||
>
|
|
||||||
<ListItem disablePadding>
|
|
||||||
<ListItemButton
|
|
||||||
sx={{
|
|
||||||
minHeight: 48,
|
|
||||||
justifyContent:
|
|
||||||
"center",
|
|
||||||
px: 2.5,
|
|
||||||
}}
|
|
||||||
onClick={handleLogout}
|
|
||||||
>
|
|
||||||
<ListItemIcon
|
|
||||||
sx={{
|
|
||||||
minWidth: 0,
|
|
||||||
justifyContent:
|
|
||||||
"center",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<MdiLogoutVariant></MdiLogoutVariant>
|
|
||||||
</ListItemIcon>
|
|
||||||
</ListItemButton>
|
|
||||||
</ListItem>
|
|
||||||
</Tooltip>
|
|
||||||
</List>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</MiniDrawer>
|
</MiniDrawer>
|
||||||
|
|
||||||
<MuiDrawer
|
<MuiDrawer
|
||||||
|
|||||||
@@ -2,36 +2,66 @@
|
|||||||
|
|
||||||
.sidemenu {
|
.sidemenu {
|
||||||
&-item {
|
&-item {
|
||||||
|
&-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
position: relative;
|
position: relative;
|
||||||
&::before {
|
width: 100%;
|
||||||
content: "";
|
color: rgb(255 255 255 / 0.7);
|
||||||
position: absolute;
|
transition: color $transition-time-fast;
|
||||||
top: 15%;
|
text-decoration: none;
|
||||||
bottom: 15%;
|
display: flex;
|
||||||
left: 7%;
|
align-items: center;
|
||||||
width: 5px;
|
justify-content: center;
|
||||||
border-radius: 10px;
|
flex-direction: column;
|
||||||
background: linear-gradient(
|
gap: 0.2em;
|
||||||
135deg,
|
margin-bottom: 0.8em;
|
||||||
$clr-accent-default,
|
|
||||||
$clr-secondary-default
|
&:hover {
|
||||||
);
|
color: white;
|
||||||
opacity: 0;
|
|
||||||
transform: translateX(-10px);
|
|
||||||
transition: transform $transition-time-default,
|
|
||||||
opacity $transition-time-default;
|
|
||||||
}
|
}
|
||||||
&.active::before {
|
|
||||||
opacity: 1;
|
&.active {
|
||||||
transform: translateX(0);
|
color: white;
|
||||||
|
.sidemenu-item-icon::before {
|
||||||
|
opacity: 1;
|
||||||
|
transform: scaleX(1);
|
||||||
|
}
|
||||||
|
.sidemenu-item-text {
|
||||||
|
max-height: 1.6em;
|
||||||
|
// transform: scaleY(1);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
&-open {
|
&-text {
|
||||||
.sidemenu-item::before {
|
// transform: scaleY(0);
|
||||||
width: 100%;
|
transform-origin: top;
|
||||||
inset: 0;
|
transition: max-height 0.5s;
|
||||||
border-radius: 0;
|
max-height: 0;
|
||||||
z-index: -1;
|
}
|
||||||
|
|
||||||
|
&-icon {
|
||||||
|
padding: 0.15em 0.75em;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
position: relative;
|
||||||
|
&::before {
|
||||||
|
content: "";
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
background: $clr-gradient-default;
|
||||||
|
z-index: -1;
|
||||||
|
transform: scaleX(0.25);
|
||||||
|
opacity: 0;
|
||||||
|
border-radius: 100px;
|
||||||
|
transition: opacity $transition-time-fast,
|
||||||
|
transform $transition-time-fast;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user