Skip to content

Commit 834c23c

Browse files
authored
Merge pull request #3 from apecloud/feat/hidden_file_support
feat: hidden file support
2 parents 7446b82 + 0afcda3 commit 834c23c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/components/SidebarMenu.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export type SidebarMenuItem = {
1414
href?: string;
1515
position: number;
1616
description?: string;
17+
hidden?: boolean,
1718
};
1819

1920
type SidebatMenuItemProps = {
@@ -38,7 +39,7 @@ export function SidebarMenuItem({ level = 1, item }: SidebatMenuItemProps) {
3839
const [open, setOpen] = useState<boolean>(checkOpen(pathname, item));
3940
const theme = useTheme();
4041
const sx = {
41-
display: "block",
42+
display: item.hidden ? "none" : "block",
4243
overflow: "hidden",
4344
textOverflow: "ellipsis",
4445
whiteSpace: "nowrap",
@@ -63,7 +64,9 @@ export function SidebarMenuItem({ level = 1, item }: SidebatMenuItemProps) {
6364
}, [pathname, item]);
6465

6566
return (
66-
<Box className="item">
67+
<Box className="item" sx={{
68+
display: item.hidden ? 'none' : 'block'
69+
}}>
6770
<Box>
6871
{item.href && _.isEmpty(item.children) ? (
6972
<Tooltip title={item.description} placement="right" arrow>

src/utils/markdown.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export const getMarkDownSideBar = async (
5252
label: metadata.title || metadata.sidebar_label,
5353
href: urlPath.replace(/^\/(en|zh)/, "/docs"),
5454
description: metadata.description,
55+
hidden: Boolean(metadata.hidden),
5556
});
5657
resolve(item);
5758
})

0 commit comments

Comments
 (0)