update 5 files

master
mahdi 2 years ago
parent 3aed367baa
commit 5b2f8bcf38
  1. 10
      src/components/Sidebar/SidebarMenu/index.js

@ -15,7 +15,9 @@ import moon from "./moon.svg";
import sms from "./sms.svg";
import userEdit from "./user-edit.svg";
import Switch from "../../Switch";
const COMPONENTS = {
Switch: <Switch />,
};
const SidebarMenu = ({ items, buttons }) => {
return (
<section>
@ -81,7 +83,7 @@ const SidebarMenu = ({ items, buttons }) => {
</p>
{/* من اینجا ۲ حالت در نظر گرفتم که یا میتونه عکس باشه یا یک کامپوننت به این دلیل که اون سویییچ را داخل یک کامپوننت دیگه درست کردم برای همین یا میشه بهش کامپوننت بدیم به عکس */}
{button.component ? (
button.component
COMPONENTS[button.component]
) : (
<img src={button.leftIcon} alt="" />
)}
@ -98,7 +100,7 @@ export default SidebarMenu;
SidebarMenu.defaultProps = {
items: [
{
icon: element,
icon: "/images/logo192.png",
title: "داشبورد مدیریت",
notification: null,
subItems: [],
@ -155,7 +157,7 @@ SidebarMenu.defaultProps = {
],
buttons: [
{ icon: moon, title: "حالت شب", leftIcon: null, component: <Switch /> },
{ icon: moon, title: "حالت شب", leftIcon: null, component: "Switch" },
{
icon: logout,
title: "خروج از حساب کاربری",

Loading…
Cancel
Save