Skip to content

Commit

Permalink
Leaning vs swing
Browse files Browse the repository at this point in the history
  • Loading branch information
davepeck committed Mar 14, 2024
1 parent 71b3a5b commit f5f73e9
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/components/More.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,23 @@ const SelectionHeadline: React.FC<{ result: StateSelectionResult }> = ({
);
};

/** Renders a detailed description of the power ranking. */
const PowerRankingDetails: React.FC<{ result: StateSelectionResult }> = ({
result,
}) => {
if (isBattleground(selectedState(result))) {
return (
<>
is a “swing state” where a small number of votes can swing the election
</>
);
} else {
return (
<>is a slightly leaning state where your vote may have more impact</>
);
}
};

/** Renders the detail text for a two-state selection. */
const SelectionDetails: React.FC<{ result: StateSelectionResult }> = ({
result,
Expand All @@ -344,8 +361,8 @@ const SelectionDetails: React.FC<{ result: StateSelectionResult }> = ({
<>
In this presidential election, your vote has more impact in{" "}
<span className="text-point">{selectedStateName(result)}</span> than
in {otherStateName(result)}. {selectedStateName(result)} is a “swing
state” where a small number of votes can swing the election.
in {otherStateName(result)}. {selectedStateName(result)}{" "}
{<PowerRankingDetails result={result} />}.
</>
);
break;
Expand Down

0 comments on commit f5f73e9

Please sign in to comment.