Skip to content

Commit a7b788d

Browse files
authored
fix: nav layout (#555)
* fix: nav layout * fix: items key * fix: docs home url
1 parent bd9fb86 commit a7b788d

File tree

2 files changed

+33
-21
lines changed

2 files changed

+33
-21
lines changed

src/components/Navigation/LeftNavTree.tsx

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
} from "shared/interface";
1616
import LinkComponent from "components/Link";
1717
import { scrollToElementIfInView } from "shared/utils";
18+
import { Tooltip } from "@mui/material";
1819

1920
type StyledTreeItemProps = TreeItemProps & {
2021
bgColor?: string;
@@ -154,6 +155,7 @@ export default function ControlledTreeView(props: {
154155
const LabelEle = () => {
155156
return (
156157
<Stack
158+
key={`${deepth}_${item.id}`}
157159
direction="row"
158160
sx={{
159161
minHeight: "1.75rem",
@@ -228,32 +230,42 @@ export default function ControlledTreeView(props: {
228230

229231
const generateItemLabel = (content: DocLeftNavItemContent) => {
230232
return (
231-
<Box sx={{ width: "100%" }}>
233+
<Box sx={{ width: "100%", overflow: "hidden", textOverflow: "ellipsis" }}>
232234
{content.map((content, index) =>
233235
typeof content === "string" ? (
234-
<Typography
236+
<Tooltip
235237
key={`${content}-${index}`}
236-
component="div"
237-
sx={{
238-
color: "inherit",
239-
fontSize: "0.875rem",
240-
lineHeight: "1.25rem",
241-
}}
238+
title={content}
239+
enterDelay={1000}
242240
>
243-
{content}
244-
</Typography>
241+
<Typography
242+
component="div"
243+
sx={{
244+
color: "inherit",
245+
fontSize: "0.875rem",
246+
lineHeight: "1.25rem",
247+
}}
248+
>
249+
{content}
250+
</Typography>
251+
</Tooltip>
245252
) : (
246-
<Typography
247-
key={`${content.value}-${index}`}
248-
component="code"
249-
sx={{
250-
color: "inherit",
251-
fontSize: "0.875rem",
252-
lineHeight: "1.25rem",
253-
}}
253+
<Tooltip
254+
key={`${content}-${index}`}
255+
title={content.value}
256+
enterDelay={1000}
254257
>
255-
{content.value}
256-
</Typography>
258+
<Typography
259+
component="code"
260+
sx={{
261+
color: "inherit",
262+
fontSize: "0.875rem",
263+
lineHeight: "1.25rem",
264+
}}
265+
>
266+
{content.value}
267+
</Typography>
268+
</Tooltip>
257269
)
258270
)}
259271
</Box>

src/shared/utils/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function generateDocsHomeUrl(lang?: string) {
3838
case "ja":
3939
return "/ja/tidbcloud";
4040
case "zh":
41-
return "/zh";
41+
return "/zh/";
4242
case "en":
4343
default:
4444
return "/";

0 commit comments

Comments
 (0)