From 0b557dae362d89139c4a18b1123a4266885350ce Mon Sep 17 00:00:00 2001 From: happycastle <41810556+happycastle114@users.noreply.github.com> Date: Thu, 30 Nov 2023 15:23:33 +0900 Subject: [PATCH 1/4] Add: ReportIntro Props --- src/components/organisms/ReportIntro.tsx | 66 +++++++++++++++++------- src/components/pages/MainPage.tsx | 4 +- 2 files changed, 48 insertions(+), 22 deletions(-) diff --git a/src/components/organisms/ReportIntro.tsx b/src/components/organisms/ReportIntro.tsx index 58d9904..39f587f 100644 --- a/src/components/organisms/ReportIntro.tsx +++ b/src/components/organisms/ReportIntro.tsx @@ -4,7 +4,11 @@ import { useLocalElectionYears } from "@/utils"; const { Title, Paragraph, Text } = Typography; -const ReportIntro = () => { +interface Props { + reportType: string; +} + +const ReportIntro = ({ reportType }: Props) => { const localElectionYears = useLocalElectionYears(); const firstElection = localElectionYears[0]; const lastElection = localElectionYears[localElectionYears.length - 1]; @@ -16,26 +20,48 @@ const ReportIntro = () => { word-break: keep-all; `} > - 우리동네 정치인 다양성 리포트 + {reportType === "nationalCouncil" + ? "대한민국 국회 다영성 리포트" + : "우리동네 정치인 다양성 리포트"} - - {lastElection.year}년 제{lastElection.ordinal}회 전국동시지방선거가 막을{" "} - 내렸어요. -
-
- 뉴웨이즈에서는 지난 {firstElection.year}년 지방선거부터{" "} - {lastElection.year}년 지방선거까지의 후보자와 당선자 데이터를 다양성{" "} - 관점에서 분석해봤어요. 연령과 성별, 정당을 기준으로 각 지역의 다양성이{" "} - 지난 선거 때와 비교해 어떻게 변화했는지 살펴보았어요. -
-
- 과연 우리 동네는 어디까지 왔을까요? -
- - 새로운 시대, 우리 동네에도 새로운 물결이 밀려오고 있을까요? -
-
-
+ {reportType === "nationalCouncil" ? ( + + {lastElection.year}년 제{lastElection.ordinal}회 총선 막을 내렸어요. +
+
+ 뉴웨이즈에서는 지난 {firstElection.year}년 총선부터{" "} + {lastElection.year}년 총선까지의 후보자와 당선자 데이터를 다양성{" "} + 관점에서 분석해봤어요. 연령과 성별, 정당을 기준으로 각 지역의 다양성이 + 지난 선거 때와 비교해 어떻게 변화했는지 살펴보았어요. +
+
+ 과연 대한민국은 어디까지 왔을까요? +
+ + 새로운 시대, 국회에도 새로운 물결이 밀려오고 있을까요? +
+
+
+ ) : ( + + {lastElection.year}년 제{lastElection.ordinal}회 전국동시지방선거가 + 막을 내렸어요. +
+
+ 뉴웨이즈에서는 지난 {firstElection.year}년 지방선거부터{" "} + {lastElection.year}년 지방선거까지의 후보자와 당선자 데이터를 다양성{" "} + 관점에서 분석해봤어요. 연령과 성별, 정당을 기준으로 각 지역의 다양성이 + 지난 선거 때와 비교해 어떻게 변화했는지 살펴보았어요. +
+
+ 과연 우리 동네는 어디까지 왔을까요? +
+ + 새로운 시대, 우리 동네에도 새로운 물결이 밀려오고 있을까요? +
+
+
+ )} ); }; diff --git a/src/components/pages/MainPage.tsx b/src/components/pages/MainPage.tsx index 1a38a8a..6eb2e3c 100644 --- a/src/components/pages/MainPage.tsx +++ b/src/components/pages/MainPage.tsx @@ -11,13 +11,13 @@ import { } from "@/components/organisms"; const MainPage = () => { - const { reportType } = useParams(); + const { reportType = "" } = useParams(); return ( - + {(() => { switch (reportType) { From 20ea296456fb0bf741726627e6f8f0ed63fbf0f2 Mon Sep 17 00:00:00 2001 From: happycastle <41810556+happycastle114@users.noreply.github.com> Date: Thu, 30 Nov 2023 15:28:14 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=EC=98=A4=ED=83=80=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/organisms/ReportIntro.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/ReportIntro.tsx b/src/components/organisms/ReportIntro.tsx index 39f587f..22a266e 100644 --- a/src/components/organisms/ReportIntro.tsx +++ b/src/components/organisms/ReportIntro.tsx @@ -21,7 +21,7 @@ const ReportIntro = ({ reportType }: Props) => { `} > {reportType === "nationalCouncil" - ? "대한민국 국회 다영성 리포트" + ? "대한민국 국회 다양성 리포트" : "우리동네 정치인 다양성 리포트"} {reportType === "nationalCouncil" ? ( From 95868db8183038bf86b7f189ff2b5baa701a75e9 Mon Sep 17 00:00:00 2001 From: happycastle <41810556+happycastle114@users.noreply.github.com> Date: Thu, 30 Nov 2023 21:33:57 +0900 Subject: [PATCH 3/4] =?UTF-8?q?Fix:=20=EB=AC=B4=EC=86=8C=EC=86=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/molecules/LocalCouncilReportText/PartyText.tsx | 2 +- src/components/molecules/MetroCouncilReportText/PartyText.tsx | 2 +- .../molecules/NationalCouncilReportText/PartyText.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/molecules/LocalCouncilReportText/PartyText.tsx b/src/components/molecules/LocalCouncilReportText/PartyText.tsx index 66439a6..2ea9715 100644 --- a/src/components/molecules/LocalCouncilReportText/PartyText.tsx +++ b/src/components/molecules/LocalCouncilReportText/PartyText.tsx @@ -146,7 +146,7 @@ export const PartyText = ({ 명의 당선자가 나왔어요.{" "} ) : null} - {independentCount !== 0 ? ( + {independentCount ? ( // 무소속 당선자가 있으면 아래 텍스트 추가 <>
diff --git a/src/components/molecules/MetroCouncilReportText/PartyText.tsx b/src/components/molecules/MetroCouncilReportText/PartyText.tsx index a3ef66d..d9da0b2 100644 --- a/src/components/molecules/MetroCouncilReportText/PartyText.tsx +++ b/src/components/molecules/MetroCouncilReportText/PartyText.tsx @@ -137,7 +137,7 @@ export const PartyText = ({ 명의 당선자가 나왔어요.{" "} ) : null} - {independentCount !== 0 ? ( + {independentCount ? ( // 무소속 당선자가 있으면 아래 텍스트 추가 <>
diff --git a/src/components/molecules/NationalCouncilReportText/PartyText.tsx b/src/components/molecules/NationalCouncilReportText/PartyText.tsx index 9b7eaa4..738a830 100644 --- a/src/components/molecules/NationalCouncilReportText/PartyText.tsx +++ b/src/components/molecules/NationalCouncilReportText/PartyText.tsx @@ -142,7 +142,7 @@ export const PartyText = ({ 명의 당선자가 나왔어요.{" "} ) : null} - {independentCount !== 0 ? ( + {independentCount ? ( // 무소속 당선자가 있으면 아래 텍스트 추가 <>
From 8d866267652cbabbdf7fb3b9a5c123a1b64248c8 Mon Sep 17 00:00:00 2001 From: happycastle <41810556+happycastle114@users.noreply.github.com> Date: Thu, 30 Nov 2023 21:38:29 +0900 Subject: [PATCH 4/4] Fix: Year list --- src/components/organisms/ReportIntro.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/organisms/ReportIntro.tsx b/src/components/organisms/ReportIntro.tsx index 22a266e..e078cde 100644 --- a/src/components/organisms/ReportIntro.tsx +++ b/src/components/organisms/ReportIntro.tsx @@ -1,6 +1,6 @@ import { Typography } from "antd"; import { css } from "@emotion/react"; -import { useLocalElectionYears } from "@/utils"; +import { useLocalElectionYears, useNationalElectionYears } from "@/utils"; const { Title, Paragraph, Text } = Typography; @@ -10,8 +10,15 @@ interface Props { const ReportIntro = ({ reportType }: Props) => { const localElectionYears = useLocalElectionYears(); - const firstElection = localElectionYears[0]; - const lastElection = localElectionYears[localElectionYears.length - 1]; + const nationalElectionYears = useNationalElectionYears(); + const firstElection = + reportType === "nationalCouncil" + ? nationalElectionYears[0] + : localElectionYears[0]; + const lastElection = + reportType === "nationalCouncil" + ? nationalElectionYears[nationalElectionYears.length - 1] + : localElectionYears[localElectionYears.length - 1]; return ( <>