-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from NewWays-TechForImpactKAIST/feat/fetch-gra…
…ph-and-text
- Loading branch information
Showing
17 changed files
with
410 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
[[redirects]] | ||
from = "/*" | ||
to = "/index.html" | ||
status = 200 | ||
status = 200 | ||
|
100 changes: 100 additions & 0 deletions
100
src/components/molecules/LocalCouncilReportText/AgeText.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import { Typography } from "antd"; | ||
|
||
const { Paragraph, Text } = Typography; | ||
|
||
export type AgeTextVariation = 1 | 2; | ||
|
||
export interface AgeTextData { | ||
metroId: number; | ||
localId: number; | ||
rankingParagraph: { | ||
ageDiversityIndex: number; | ||
allIndices: { localId: number; rank: number; ageDiversityIndex: number }[]; | ||
}; | ||
indexHistoryParagraph: { | ||
mostRecentYear: number; | ||
history: { | ||
year: number; | ||
unit: number; | ||
candidateCount: number; | ||
candidateDiversityIndex: number; | ||
electedDiversityIndex: number; | ||
electedDiversityRank: number; | ||
}[]; | ||
}; | ||
ageHistogramParagraph: { | ||
year: number; | ||
candidateCount: number; | ||
electedCount: number; | ||
firstQuintile: number; | ||
lastQuintile: number; | ||
divArea: { | ||
localId: number; | ||
firstQuintile: number; | ||
lastQuintile: number; | ||
}; | ||
uniArea: { | ||
localId: number; | ||
firstQuintile: number; | ||
lastQuintile: number; | ||
}; | ||
}; | ||
} | ||
|
||
interface Props { | ||
/** text variation을 선택할 수 있습니다(기본값: 1). */ | ||
variation?: AgeTextVariation; | ||
/** text에 들어갈 데이터입니다. */ | ||
data?: AgeTextData; | ||
getNameFromId: (id: number) => [string, string] | undefined; | ||
} | ||
|
||
export const AgeText = ({ | ||
variation = 1, | ||
data = undefined, | ||
getNameFromId, | ||
}: Props) => { | ||
if (!data) return <Paragraph>데이터를 불러오는 중입니다..</Paragraph>; | ||
|
||
const { | ||
localId, | ||
// rankingParagraph, | ||
// indexHistoryParagraph, | ||
ageHistogramParagraph, | ||
} = data; | ||
if (variation === 1) | ||
return ( | ||
<Paragraph> | ||
<Text strong>{ageHistogramParagraph.year}</Text>년 전국동시지방선거에서{" "} | ||
<Text strong>{getNameFromId(localId)?.join(" ")}</Text> | ||
에는 <Text strong>{ageHistogramParagraph.candidateCount}</Text>명이{" "} | ||
후보로 나와 <Text strong>{ageHistogramParagraph.electedCount}</Text>명이{" "} | ||
당선됐어요. 당선자의 20%가{" "} | ||
<Text strong>{ageHistogramParagraph.firstQuintile}</Text>세 미만, 20%가{" "} | ||
{ageHistogramParagraph.lastQuintile}세 이상이에요. | ||
<br /> | ||
<br /> | ||
참고로 다양성 지표 전국 1위는 전체 인원의 20%가{" "} | ||
<Text strong>{ageHistogramParagraph.divArea.firstQuintile}</Text>세{" "} | ||
미만, 20%가{" "} | ||
<Text strong>{ageHistogramParagraph.divArea.lastQuintile}</Text>세{" "} | ||
이상인{" "} | ||
<Text strong> | ||
{getNameFromId(ageHistogramParagraph.divArea.localId)?.join(" ")} | ||
</Text> | ||
, 전국 뒤에서 1위는 전체 인원의 20%가{" "} | ||
<Text strong>{ageHistogramParagraph.uniArea.firstQuintile}</Text>세 | ||
미만, 20%가{" "} | ||
<Text strong>{ageHistogramParagraph.uniArea.lastQuintile}</Text>세 | ||
이상인{" "} | ||
<Text strong> | ||
{getNameFromId(ageHistogramParagraph.uniArea.localId)?.join(" ")} | ||
</Text> | ||
예요. | ||
<br /> | ||
<br /> | ||
이전 정보를 확인하려면 아래의 슬라이더를 밀어 보세요. | ||
</Paragraph> | ||
); | ||
return <Paragraph>존재하지 않는 템플릿입니다.</Paragraph>; | ||
}; |
30 changes: 30 additions & 0 deletions
30
src/components/molecules/LocalCouncilReportText/GenderText.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Typography } from "antd"; | ||
|
||
const { Paragraph, Text } = Typography; | ||
|
||
export type GenderTextVariation = 1 | 2; | ||
|
||
export interface GenderTextData { | ||
genderDiversityIndex: number; | ||
} | ||
|
||
interface Props { | ||
/** text variation을 선택할 수 있습니다(기본값: 1). */ | ||
variation?: GenderTextVariation; | ||
/** text에 들어갈 데이터입니다. */ | ||
data?: GenderTextData; | ||
} | ||
|
||
export const GenderText = ({ variation = 1, data = undefined }: Props) => { | ||
if (!data) return <Paragraph>데이터를 불러오는 중입니다..</Paragraph>; | ||
|
||
const { genderDiversityIndex } = data; | ||
if (variation === 1) | ||
return ( | ||
<Paragraph> | ||
이 지역의 성별 다양성 지표의 값은{" "} | ||
<Text strong>{genderDiversityIndex}</Text>입니다. | ||
</Paragraph> | ||
); | ||
return <Paragraph>존재하지 않는 템플릿입니다.</Paragraph>; | ||
}; |
30 changes: 30 additions & 0 deletions
30
src/components/molecules/LocalCouncilReportText/PartyText.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Typography } from "antd"; | ||
|
||
const { Paragraph, Text } = Typography; | ||
|
||
export type PartyTextVariation = 1 | 2; | ||
|
||
export interface PartyTextData { | ||
partyDiversityIndex: number; | ||
} | ||
|
||
interface Props { | ||
/** text variation을 선택할 수 있습니다(기본값: 1). */ | ||
variation?: PartyTextVariation; | ||
/** text에 들어갈 데이터입니다. */ | ||
data?: PartyTextData; | ||
} | ||
|
||
export const PartyText = ({ variation = 1, data = undefined }: Props) => { | ||
if (!data) return <Paragraph>데이터를 불러오는 중입니다..</Paragraph>; | ||
|
||
const { partyDiversityIndex } = data; | ||
if (variation === 1) | ||
return ( | ||
<Paragraph> | ||
이 지역의 정당 다양성 지표의 값은{" "} | ||
<Text strong>{partyDiversityIndex}</Text>입니다. | ||
</Paragraph> | ||
); | ||
return <Paragraph>존재하지 않는 템플릿입니다.</Paragraph>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from "./AgeText"; | ||
export * from "./GenderText"; | ||
export * from "./PartyText"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.