Skip to content

Commit

Permalink
pref 优化layout组件
Browse files Browse the repository at this point in the history
  • Loading branch information
sikara committed Nov 20, 2024
1 parent c65b611 commit 33c2725
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/Layout.tsx
Original file line number Diff line number Diff line change
@@ -69,7 +69,11 @@ export default function ResponsiveDrawer(props: Props) {
);

const navTitle = useMemo(() => {
return menuList.find((item) => item.path === loc.pathname)?.name;
return (
<Typography variant="h6" noWrap component="div">
{menuList.find((item) => item.path === loc.pathname)?.name}
</Typography>
);
}, [loc.pathname]);

const container =
@@ -116,9 +120,7 @@ export default function ResponsiveDrawer(props: Props) {
</defs>
</svg>
</IconButton>
<Typography variant="h6" noWrap component="div">
{navTitle}
</Typography>
{navTitle}
</Toolbar>
</AppBar>
<Box
@@ -165,9 +167,9 @@ export default function ResponsiveDrawer(props: Props) {
flexGrow: 1,
p: 3,
width: { sm: `calc(100% - ${drawerWidth}px)` },
paddingTop: 8,
}}
>
<Box sx={{ height: 48 }} />
{children}
</Box>
</Box>

0 comments on commit 33c2725

Please sign in to comment.