Skip to content

Commit

Permalink
Pass onClick instead of state handler and keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmoud authored and Mahmoud committed Nov 28, 2022
1 parent 536fac2 commit db30690
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,7 @@ export const Configuration: React.FC<MetricConfigurationProps> = observer(
{/* Race & Ethnicities Grid (when active disaggregation is Race / Ethnicity) */}
{activeDisaggregationKey === RACE_ETHNICITY_DISAGGREGATION_KEY ? (
<RaceEthnicitiesGrid
activeDimensionKeys={activeDimensionKeys}
setActiveDimensionKey={setActiveDimensionKey}
onClick={() => setActiveDimensionKey(activeDimensionKeys[0])}
/>
) : (
activeDimensionKeys?.map((dimensionKey) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,14 @@ import {
} from ".";

export const RaceEthnicitiesGrid: React.FC<{
activeDimensionKeys: string[];
setActiveDimensionKey: React.Dispatch<
React.SetStateAction<string | undefined>
>;
}> = observer(({ activeDimensionKeys, setActiveDimensionKey }) => {
onClick: () => void;
}> = observer(({ onClick }) => {
const { metricConfigStore } = useStore();
const { ethnicitiesByRace } = metricConfigStore;

return (
<RaceEthnicitiesBreakdownContainer>
<CalloutBox onClick={() => setActiveDimensionKey(activeDimensionKeys[0])}>
<CalloutBox onClick={onClick}>
<Description>
Answer the questions on the <span>Race and Ethnicity</span> form; the
grid below will reflect your responses.
Expand Down

0 comments on commit db30690

Please sign in to comment.