Skip to content

Commit

Permalink
Menu's background size adjusted, Functions name, Logic rellocated out…
Browse files Browse the repository at this point in the history
…side of JSX
  • Loading branch information
Paxxack committed Sep 30, 2024
1 parent ecaab3a commit bcd8b59
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 38 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
8 changes: 5 additions & 3 deletions Client/src/Components/Sidebar/DropdownMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default function DropdownMenu() {
setAnchorEl(null);
};

function fixName(text: string): string {
function removeEmptySpace(text: string): string {
return text.replace(/\s+/g, "");
}

Expand All @@ -62,6 +62,8 @@ export default function DropdownMenu() {
Logout: LogOut,
};

const menu: string[] = ["Profile", "Team", "Log out"];

return (
<Box>
<Button
Expand Down Expand Up @@ -89,7 +91,7 @@ export default function DropdownMenu() {
</Button>

<StyledMenu anchorEl={anchorEl} open={open} onClose={handleClose}>
{["Profile","Team", "Log out"].map((text) => (
{menu.map((text) => (
<Link href={`${text.toLowerCase()}`} className="no-styling">
<MenuItem
onClick={handleClose}
Expand All @@ -99,7 +101,7 @@ export default function DropdownMenu() {
<Image
src={
text.includes(" ")
? menuItems[fixName(text)]
? menuItems[removeEmptySpace(text)]
: menuItems[text]
}
alt={text}
Expand Down
14 changes: 11 additions & 3 deletions Client/src/Components/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export default function Sidebar() {
Settings: SettingsIcon,
};

const menu: string[] = ["Documents", "Contacts", "Settings"];

return (
<Stack
justifyContent="space-between"
Expand All @@ -33,12 +35,18 @@ export default function Sidebar() {
<Box>
<Image src={Title} alt="Title" style={{ margin: "0 8px 16px 8px" }} />
<List>
{["Documents", "Contacts", "Settings"].map((text) => (
{menu.map((text) => (
<ListItem key={text} disablePadding>
<Link href={`/${text.toLowerCase()}`} className="no-styling">
<Link
href={`/${text.toLowerCase()}`}
className="no-styling width-area"
>
<ListItemButton
disableRipple
sx={{ px: 1, "&:hover": { backgroundColor: "#f5f9ff" } }}
sx={{
px: 1,
"&:hover": { backgroundColor: "#f5f9ff" },
}}
>
<ListItemIcon>
<Image src={menuItems[text]} alt={text} height={24} />
Expand Down
4 changes: 4 additions & 0 deletions Client/src/Components/Sidebar/dropdownMenu.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
text-decoration: none;
color: inherit;
}

.width-area {
width: 100%;
}
66 changes: 34 additions & 32 deletions Client/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,42 +1,44 @@
import type { Metadata } from 'next';
import { Inter } from 'next/font/google';
import { Container } from '@mui/material';
import Sidebar from '@/components/sidebar/Sidebar';
import CssBaseline from '@mui/material/CssBaseline';
import globalTheme from '@/utils/theme/globalTheme';
import { ThemeProvider } from '@mui/material/styles';
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import { Container } from "@mui/material";
import Sidebar from "@/components/sidebar/Sidebar";
import CssBaseline from "@mui/material/CssBaseline";
import globalTheme from "@/utils/theme/globalTheme";
import { ThemeProvider } from "@mui/material/styles";

const inter = Inter({ subsets: ['latin'] });
const inter = Inter({ subsets: ["latin"] });

export const metadata: Metadata = {
title: 'Blw-Dataroom',
description: 'Share documents safely with your team and customers',
title: "Blw-Dataroom",
description: "Share documents safely with your team and customers",
};

interface RootLayoutProps {
children: React.ReactNode;
children: React.ReactNode;
}

export default function RootLayout({ children }: RootLayoutProps) {
return (
<html lang="en">
<body className={inter.className}>
<ThemeProvider theme={globalTheme}>
<CssBaseline />
<Container
sx={{
display: 'flex',
backgroundColor: 'white',
height: '100vh',
pt: 4,
pb: 3,
gap: 4,
}}>
<Sidebar />
{children}
</Container>
</ThemeProvider>
</body>
</html>
);
return (
<html lang="en">
<body className={inter.className}>
<ThemeProvider theme={globalTheme}>
<CssBaseline />
<Container
sx={{
display: "flex",
backgroundColor: "white",
height: "100vh",

pt: 4,
pb: 3,
gap: 4,
}}
>
<Sidebar />
<>{children}</>
</Container>
</ThemeProvider>
</body>
</html>
);
}

0 comments on commit bcd8b59

Please sign in to comment.