Skip to content

Commit

Permalink
Merge pull request #16 from dataesr/chartsSelector
Browse files Browse the repository at this point in the history
add a chart selector
  • Loading branch information
jerem1508 authored Mar 13, 2024
2 parents ef3a96d + 66be4d5 commit f3ad231
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect } from "react";
import { useEffect, useState } from "react";
import { Container, Title } from "@dataesr/dsfr-plus";
import { useSearchParams } from "react-router-dom";

Expand All @@ -8,6 +8,7 @@ import FundingRanking from "./charts/funding-ranking";

export default function Positioning() {
const [searchParams, setSearchParams] = useSearchParams();
const [selectedChart, setSelectedChart] = useState('fundingRankingSub');

useEffect(() => {
if (!searchParams.get('country_code')) {
Expand All @@ -22,14 +23,17 @@ export default function Positioning() {
<div className="fr-my-5w" />
<Top10Beneficiaries />
<div className="fr-my-5w" />
<Title as="h2" look="h4">Focus sur les subventions</Title>
<FundingRanking indicateurId="fundingRankingSub" />
<div className="fr-my-5w" />
<Title as="h2" look="h4">Focus sur les coordinations de projets</Title>
<FundingRanking indicateurId="fundingRankingCoordination" />
<div className="fr-my-5w" />
<Title as="h2" look="h4">Focus sur les candidats et participants</Title>
<FundingRanking indicateurId="fundingRankingInvolved" />
<Title as="h2" look="h4">Top 10 par indicateur</Title>
<select
className="fr-select fr-mb-3w"
onChange={(e) => setSelectedChart(e.target.value)}
value={selectedChart}
>
<option value="fundingRankingSub">Focus sur les subventions</option>
<option value="fundingRankingCoordination">Focus sur les coordinations de projets</option>
<option value="fundingRankingInvolved">Focus sur les candidats et participants</option>
</select>
<FundingRanking indicateurId={selectedChart} />
</Container>
);
}

0 comments on commit f3ad231

Please sign in to comment.