Skip to content

Commit

Permalink
Fix: Year list
Browse files Browse the repository at this point in the history
  • Loading branch information
happycastle114 committed Nov 30, 2023
1 parent 9cc947c commit 8d86626
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/components/organisms/ReportIntro.tsx
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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 (
<>
<Title
Expand Down

0 comments on commit 8d86626

Please sign in to comment.