Simplify dashboard code
This commit is contained in:
@@ -12,7 +12,6 @@ import DashboardSidebarContext from "./DashboardSidebarContext";
|
||||
import { MINI_DRAWER_WIDTH } from "./constants";
|
||||
|
||||
export interface DashboardSidebarPageItemProps {
|
||||
id: string;
|
||||
title: string;
|
||||
icon?: React.ReactNode;
|
||||
href: string;
|
||||
@@ -21,7 +20,6 @@ export interface DashboardSidebarPageItemProps {
|
||||
}
|
||||
|
||||
export default function DashboardSidebarPageItem({
|
||||
id,
|
||||
title,
|
||||
icon,
|
||||
href,
|
||||
@@ -40,12 +38,6 @@ export default function DashboardSidebarPageItem({
|
||||
fullyExpanded = true,
|
||||
} = sidebarContext;
|
||||
|
||||
const handleClick = React.useCallback(() => {
|
||||
if (onPageItemClick) {
|
||||
onPageItemClick();
|
||||
}
|
||||
}, [onPageItemClick, id]);
|
||||
|
||||
const hasExternalHref = href
|
||||
? href.startsWith("http://") || href.startsWith("https://")
|
||||
: false;
|
||||
@@ -56,7 +48,7 @@ export default function DashboardSidebarPageItem({
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<ListItem disablePadding>
|
||||
<ListItem disablePadding style={{ padding: "5px" }}>
|
||||
<ListItemButton
|
||||
selected={selected}
|
||||
disabled={disabled}
|
||||
@@ -72,7 +64,7 @@ export default function DashboardSidebarPageItem({
|
||||
}
|
||||
: {}),
|
||||
to: href,
|
||||
onClick: handleClick,
|
||||
onClick: onPageItemClick,
|
||||
}}
|
||||
>
|
||||
{icon || mini ? (
|
||||
|
||||
Reference in New Issue
Block a user