Skip to content

Commit bd0e8e6

Browse files
committed
feat: 숨기려는 sitemap은 상단에 노출되지 않도록 수정
1 parent c8ea6da commit bd0e8e6

File tree

3 files changed

+40
-30
lines changed

3 files changed

+40
-30
lines changed

apps/pyconkr/src/components/layout/Header/index.tsx

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,15 @@ const Header: React.FC = () => {
6161
{siteMapNode ? (
6262
<>
6363
<Stack direction="row" alignItems="center" justifyContent="center" spacing={2}>
64-
{Object.values(siteMapNode.children).map((r) => (
65-
<Link key={r.id} to={r.route_code} onClick={resetDepths}>
66-
<Button key={r.id} onMouseEnter={() => setDepth1(r)} sx={{ minWidth: 0, textTransform: "none" }}>
67-
{r.name}
68-
</Button>
69-
</Link>
70-
))}
64+
{Object.values(siteMapNode.children)
65+
.filter((s) => !s.hide)
66+
.map((r) => (
67+
<Link key={r.id} to={r.route_code} onClick={resetDepths}>
68+
<Button key={r.id} onMouseEnter={() => setDepth1(r)} sx={{ minWidth: 0, textTransform: "none" }}>
69+
{r.name}
70+
</Button>
71+
</Link>
72+
))}
7173
</Stack>
7274

7375
{navState.depth1 && (
@@ -79,36 +81,40 @@ const Header: React.FC = () => {
7981
<Depth1to2Divider flexItem />
8082
<Stack direction="row" spacing={4}>
8183
<Stack spacing={1.25}>
82-
{Object.values(navState.depth1.children).map((r) => (
83-
<Depth2Item
84-
children={r.name}
85-
className={r.id === navState.depth2?.id ? "active" : ""}
86-
key={r.id}
87-
onClick={resetDepths}
88-
onMouseEnter={() => setDepth2(r)}
89-
// 하위 depth가 있는 경우, 하위 depth를 선택할 수 있도록 유지하기 위해 depth2도 유지합니다.
90-
onMouseLeave={() => R.isEmpty(navState.depth2?.children ?? {}) && setDepth2(undefined)}
91-
to={getDepth2Route(r.route_code)}
92-
/>
93-
))}
84+
{Object.values(navState.depth1.children)
85+
.filter((s) => !s.hide)
86+
.map((r) => (
87+
<Depth2Item
88+
children={r.name}
89+
className={r.id === navState.depth2?.id ? "active" : ""}
90+
key={r.id}
91+
onClick={resetDepths}
92+
onMouseEnter={() => setDepth2(r)}
93+
// 하위 depth가 있는 경우, 하위 depth를 선택할 수 있도록 유지하기 위해 depth2도 유지합니다.
94+
onMouseLeave={() => R.isEmpty(navState.depth2?.children ?? {}) && setDepth2(undefined)}
95+
to={getDepth2Route(r.route_code)}
96+
/>
97+
))}
9498
</Stack>
9599

96100
{navState.depth2 && !R.isEmpty(navState.depth2.children) && (
97101
<>
98102
{!R.isEmpty(navState.depth2.children) && <Depth2to3Divider orientation="vertical" flexItem />}
99103

100104
<Stack spacing={1.5}>
101-
{Object.values(navState.depth2.children).map((r) => (
102-
<Depth3Item
103-
children={r.name}
104-
className={r.id === navState.depth3?.id ? "active" : ""}
105-
key={r.id}
106-
onClick={resetDepths}
107-
onMouseEnter={() => setDepth3(r)}
108-
onMouseLeave={() => setDepth3(undefined)}
109-
to={getDepth3Route(r?.route_code)}
110-
/>
111-
))}
105+
{Object.values(navState.depth2.children)
106+
.filter((s) => !s.hide)
107+
.map((r) => (
108+
<Depth3Item
109+
children={r.name}
110+
className={r.id === navState.depth3?.id ? "active" : ""}
111+
key={r.id}
112+
onClick={resetDepths}
113+
onMouseEnter={() => setDepth3(r)}
114+
onMouseLeave={() => setDepth3(undefined)}
115+
to={getDepth3Route(r?.route_code)}
116+
/>
117+
))}
112118
</Stack>
113119
</>
114120
)}

packages/common/src/components/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
NetworkLottiePlayer as NetworkLottiePlayerComponent,
99
} from "./lottie";
1010
import { MDXRenderer as MDXRendererComponent } from "./mdx";
11+
import { Confetti as ConfettiComponent } from "./mdx_components/confetti";
1112
import {
1213
FAQAccordion as FAQAccordionComponent,
1314
type FAQAccordionProps as FAQAccordionPropsType,
@@ -37,6 +38,7 @@ namespace Components {
3738
export const LinkHandler = LinkHandlerComponent;
3839

3940
export namespace MDX {
41+
export const Confetti = ConfettiComponent;
4042
export const StyledFullWidthButton = StyledFullWidthButtonComponent;
4143
export const PrimaryStyledDetails = PrimaryStyledDetailsComponent;
4244
export const SecondaryStyledDetails = SecondaryStyledDetailsComponent;

packages/common/src/schemas/backendAPI.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ namespace BackendAPISchemas {
2121
order: number;
2222
parent_sitemap: string | null;
2323
page: string;
24+
hide: boolean;
2425
};
2526

2627
export type NestedSiteMapSchema = {
@@ -29,6 +30,7 @@ namespace BackendAPISchemas {
2930
name: string;
3031
order: number;
3132
page: string;
33+
hide: boolean;
3234
children: { [key: string]: NestedSiteMapSchema };
3335
};
3436

0 commit comments

Comments
 (0)