Skip to content

Commit

Permalink
Add: React Map Selector
Browse files Browse the repository at this point in the history
  • Loading branch information
happycastle114 committed Nov 20, 2023
1 parent ace1457 commit b09b9be
Showing 1 changed file with 33 additions and 24 deletions.
57 changes: 33 additions & 24 deletions src/components/pages/LocalCouncil.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
import React from "react";
import React, { useState } from "react";
import { Flex } from "antd";
import { css } from "@emotion/react";

import { Layout } from "@/components/templates";
import { LocalSelector, MetroSelector } from "@/components/organisms";
import { MetroID } from "static/MapSVGData";
import { useNavigate } from "react-router-dom";

const LocalCouncil: React.FC = () => (
<Layout>
<Flex
vertical
gap={40}
css={css`
margin: 40px 0 40px 0;
`}
>
<LocalSelector
selected="서울특별시"
onClick={id => {
alert(id);
}}
/>
<MetroSelector
onClick={id => {
alert(id);
}}
/>
</Flex>
</Layout>
);
const LocalCouncil: React.FC = () => {
const [metroId, setMetroId] = useState<MetroID>();
const navigate = useNavigate();
return (
<Layout>
<Flex
vertical
gap={40}
css={css`
margin: 40px 0 40px 0;
`}
>
{metroId ? (
<LocalSelector
selected={metroId}
onClick={id => {
navigate(`/localCouncilReport/${metroId}/${id}`);
}}
/>
) : (
<MetroSelector
onClick={id => {
setMetroId(id as MetroID);
}}
/>
)}
</Flex>
</Layout>
);
};

export default LocalCouncil;

0 comments on commit b09b9be

Please sign in to comment.