Skip to content

Commit 7f183e1

Browse files
Nirav JoshiNirav Joshi
authored andcommitted
changes
1 parent 6c6c2ab commit 7f183e1

File tree

6 files changed

+28
-14
lines changed

6 files changed

+28
-14
lines changed

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,19 @@ For any Issues, create new issue on https://github.com/adminmart/react-mui-sideb
3434
import React from "react";
3535

3636
import { Sidebar, Menu, MenuItem, Submenu, Logo } from "react-mui-sidebar";
37-
37+
import AccessAlarms from "@mui/icons-material/AccessAlarms";
38+
import CottageOutlinedIcon from '@mui/icons-material/CottageOutlined';
3839
const App = () => {
3940
return (
4041
<Sidebar width={"270px"}>
4142
<Logo img="https://adminmart.com/wp-content/uploads/2024/03/logo-admin-mart-news.png">
4243
AdminMart
4344
</Logo>
4445
<Menu subHeading="HOME">
45-
<MenuItem link="/" badge={true}>
46+
<MenuItem icon={<CottageOutlinedIcon/>} link="/" badge={true}> {/* Set badge to boolean true */}
4647
Modern
4748
</MenuItem>
48-
<MenuItem>eCommerce</MenuItem>
49+
<MenuItem icon={<AccessAlarms/>}>eCommerce</MenuItem>
4950
<MenuItem>Analytical</MenuItem>
5051
</Menu>
5152
<Menu subHeading="APPS">
@@ -149,6 +150,17 @@ export default App;
149150
| :---- | :------- | :--------- | --------------------------- |
150151
| `img` | `string` | `Logo url` | set the logo of the sidebar |
151152

153+
#### User Profile LogOut Api Reference
154+
155+
```http
156+
<Logo></Logo>
157+
```
158+
159+
| Props | Type | Default | Description |
160+
| :----------| :--------- | :--------- | --------------------------- |
161+
| `onLogout` | `function` | `void` | set the logo of the sidebar |
162+
163+
152164
## Contributing
153165

154166
Contributions are always welcome!

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-mui-sidebar",
3-
"version": "1.5.2",
3+
"version": "1.5.3",
44
"description": "react mui sidebar",
55
"main": "dist/index.js",
66
"type": "module",

src/App.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import { Logo } from "./components/Logo";
66
import { Menu } from "./components/Menu";
77
import { MenuItem } from "./components/MenuItem";
88
import { Submenu } from './components/Submenu';
9-
10-
9+
import AccessAlarms from "@mui/icons-material/AccessAlarms";
10+
import CottageOutlinedIcon from '@mui/icons-material/CottageOutlined';
1111

1212
function App() {
1313
return (
@@ -16,10 +16,10 @@ function App() {
1616
AdminMart
1717
</Logo>
1818
<Menu subHeading="HOME">
19-
<MenuItem link="/" badge={true}> {/* Set badge to boolean true */}
19+
<MenuItem icon={<CottageOutlinedIcon/>} link="/" badge={true}> {/* Set badge to boolean true */}
2020
Modern
2121
</MenuItem>
22-
<MenuItem>eCommerce</MenuItem>
22+
<MenuItem icon={<AccessAlarms/>}>eCommerce</MenuItem>
2323
<MenuItem>Analytical</MenuItem>
2424
</Menu>
2525
<Menu subHeading="APPS">

src/components/MenuItem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ const MenuItem = React.forwardRef<HTMLAnchorElement, MenuItemProps>(
8181
alignItems: "center",
8282
gap: "10px",
8383
marginBottom: "0px",
84-
padding: "0px 0px",
84+
padding: "0px",
8585
cursor: "pointer",
86-
marginLeft: "-10px",
86+
8787
color: "inherit",
8888
}));
8989

src/components/UserProfile.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ interface ProfileProps {
88
designation?: string;
99
userimg?: string;
1010
isCollapse?: boolean;
11+
onLogout?: () => void;
1112
}
1213

1314
const Profile = React.forwardRef<HTMLDivElement, ProfileProps>(({
1415
userName = "",
1516
designation = "",
1617
userimg = "",
17-
isCollapse = false
18+
isCollapse = false,
19+
onLogout
1820
}, ref) => {
1921
const theme = useTheme();
2022
return (
@@ -34,7 +36,7 @@ const Profile = React.forwardRef<HTMLDivElement, ProfileProps>(({
3436
{designation}
3537
</Typography>
3638
</Box>
37-
<Box sx={{ ml: 'auto' }}>
39+
<Box sx={{ ml: 'auto' }} onClick={onLogout}>
3840
<Tooltip title="Logout" placement="top">
3941
{/* <Link to="/"> Wrap the IconButton with Link */}
4042
<IconButton

0 commit comments

Comments
 (0)