Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breadcrumb #35

Merged
merged 4 commits into from
Nov 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 43 additions & 8 deletions src/components/organisms/MapSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, Flex } from "antd";
import { Button, Flex, Breadcrumb } from "antd";
import { css } from "@emotion/react";
import {
LocalSelector,
Expand All @@ -15,7 +15,7 @@ interface Props {
}

const MapSelector = ({ idMap, type = "local" }: Props) => {
const { metroName } = useParams();
const { metroName, localName } = useParams();
const navigate = useNavigate();

return (
Expand All @@ -30,6 +30,41 @@ const MapSelector = ({ idMap, type = "local" }: Props) => {
>
{metroName && type === "local" ? (
<>
<div
css={css`
text-align: left;
width: 100%;
font-size: 24pt;
`}
>
<Breadcrumb
items={(
[
{
title: (
// eslint-disable-next-line jsx-a11y/anchor-is-valid
<a>뉴웨이즈 다양성 리포트</a>
),
onClick: () => navigate(`/localCouncil`),
},
] as { title: string | JSX.Element; onClick: () => void }[]
)
.concat(
metroName
? [
{
// eslint-disable-next-line jsx-a11y/anchor-is-valid
title: <a>{metroName}</a>,
onClick: () => navigate(`/localCouncil/${metroName}`),
},
]
: [],
)
.concat(
localName ? [{ title: localName, onClick: () => {} }] : [],
)}
/>
</div>
<Flex
justify="center"
align="center"
Expand All @@ -40,10 +75,10 @@ const MapSelector = ({ idMap, type = "local" }: Props) => {
<DropdownSelector
innerText="기초 의회를 선택하세요."
options={[...(idMap.get(metroName as MetroID)?.keys() || [])]}
onClick={localName => {
const idData = idMap.get(metroName as MetroID)?.get(localName);
onClick={local => {
const idData = idMap.get(metroName as MetroID)?.get(local);
if (!idData) return;
navigate(`/localCouncil/${metroName}/${localName}`);
navigate(`/localCouncil/${metroName}/${local}`);
}}
/>
<div
Expand All @@ -65,10 +100,10 @@ const MapSelector = ({ idMap, type = "local" }: Props) => {
</Flex>
<LocalSelector
selected={metroName as MetroID}
onClick={localName => {
const idData = idMap.get(metroName as MetroID)?.get(localName);
onClick={local => {
const idData = idMap.get(metroName as MetroID)?.get(local);
if (!idData) return;
navigate(`/localCouncil/${metroName}/${localName}`);
navigate(`/localCouncil/${metroName}/${local}`);
}}
/>
</>
Expand Down