chore: center

This commit is contained in:
MystiPanda 2024-03-09 23:38:03 +08:00
parent eb6fa5f1f1
commit 8268df84d0
2 changed files with 10 additions and 12 deletions

View File

@ -14,7 +14,7 @@ interface Props {
icon: React.ReactNode; icon: React.ReactNode;
} }
export const LayoutItem = (props: Props) => { export const LayoutItem = (props: Props) => {
const { to, children, icon: Icon } = props; const { to, children, icon } = props;
const resolved = useResolvedPath(to); const resolved = useResolvedPath(to);
const match = useMatch({ path: resolved.pathname, end: true }); const match = useMatch({ path: resolved.pathname, end: true });
@ -53,10 +53,8 @@ export const LayoutItem = (props: Props) => {
]} ]}
onClick={() => navigate(to)} onClick={() => navigate(to)}
> >
<ListItemIcon sx={{ marginRight: -0.5 }}> <ListItemIcon sx={{ marginRight: -0.5 }}>{icon}</ListItemIcon>
<Icon /> <ListItemText sx={{ textAlign: "center" }} primary={children} />
</ListItemIcon>
<ListItemText primary={children} />
</ListItemButton> </ListItemButton>
</ListItem> </ListItem>
); );

View File

@ -18,43 +18,43 @@ export const routers = [
{ {
label: "Label-Proxies", label: "Label-Proxies",
link: "/", link: "/",
icon: ProxiesSvg, icon: <ProxiesSvg />,
ele: ProxiesPage, ele: ProxiesPage,
}, },
{ {
label: "Label-Profiles", label: "Label-Profiles",
link: "/profile", link: "/profile",
icon: ProfilesSvg, icon: <ProfilesSvg />,
ele: ProfilesPage, ele: ProfilesPage,
}, },
{ {
label: "Label-Connections", label: "Label-Connections",
link: "/connections", link: "/connections",
icon: ConnectionsSvg, icon: <ConnectionsSvg />,
ele: ConnectionsPage, ele: ConnectionsPage,
}, },
{ {
label: "Label-Rules", label: "Label-Rules",
link: "/rules", link: "/rules",
icon: RulesSvg, icon: <RulesSvg />,
ele: RulesPage, ele: RulesPage,
}, },
{ {
label: "Label-Logs", label: "Label-Logs",
link: "/logs", link: "/logs",
icon: LogsSvg, icon: <LogsSvg />,
ele: LogsPage, ele: LogsPage,
}, },
{ {
label: "Label-Test", label: "Label-Test",
link: "/test", link: "/test",
icon: TestSvg, icon: <TestSvg />,
ele: TestPage, ele: TestPage,
}, },
{ {
label: "Label-Settings", label: "Label-Settings",
link: "/settings", link: "/settings",
icon: SettingsSvg, icon: <SettingsSvg />,
ele: SettingsPage, ele: SettingsPage,
}, },
]; ];