fix: default value

This commit is contained in:
MystiPanda 2024-03-11 13:17:45 +08:00
parent 18fdc5c6a2
commit c4a5c356f7

View File

@ -15,7 +15,7 @@ interface Props {
export const LayoutItem = (props: Props) => { export const LayoutItem = (props: Props) => {
const { to, children, icon } = props; const { to, children, icon } = props;
const { verge } = useVerge(); const { verge } = useVerge();
const { menu_icon = "monochrome" } = verge ?? {}; const { menu_icon } = verge ?? {};
const resolved = useResolvedPath(to); const resolved = useResolvedPath(to);
const match = useMatch({ path: resolved.pathname, end: true }); const match = useMatch({ path: resolved.pathname, end: true });
const navigate = useNavigate(); const navigate = useNavigate();
@ -52,9 +52,12 @@ export const LayoutItem = (props: Props) => {
]} ]}
onClick={() => navigate(to)} onClick={() => navigate(to)}
> >
{menu_icon === "monochrome" && ( {menu_icon === "monochrome" ||
<ListItemIcon sx={{ color: "text.primary" }}>{icon[0]}</ListItemIcon> (!menu_icon && (
)} <ListItemIcon sx={{ color: "text.primary" }}>
{icon[0]}
</ListItemIcon>
))}
{menu_icon === "colorful" && <ListItemIcon>{icon[1]}</ListItemIcon>} {menu_icon === "colorful" && <ListItemIcon>{icon[1]}</ListItemIcon>}
<ListItemText <ListItemText
sx={{ sx={{