Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Update type naming for singlar and plural colorMatches
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorrik-Klijnsma-Work committed Aug 1, 2022
1 parent b5529aa commit 85b81ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { NlVariants, colors } from '@corona-dashboard/common';
import { isDefined } from 'ts-is-present';
import { VariantCode } from './'

type SingleColorMatchType = {
type ColorMatch = {
variant: VariantCode;
color: string;
};

export type ColorMatch = SingleColorMatchType[];
export type ColorMatches = ColorMatch[];

const getColorForVariant = (variantCode: VariantCode, index: number): string => {
if (variantCode === 'other_table') return colors.data.variants.other_table;
Expand All @@ -18,7 +18,7 @@ const getColorForVariant = (variantCode: VariantCode, index: number): string =>

export function getVariantOrderColors(
variants: NlVariants | undefined
): ColorMatch {
): ColorMatches {
if (!isDefined(variants) || !isDefined(variants.values)) {
return [];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '@corona-dashboard/common';
import { first } from 'lodash';
import { isDefined, isPresent } from 'ts-is-present';
import { ColorMatch } from './get-variant-order-colors';
import { ColorMatches } from './get-variant-order-colors';
import { VariantCode } from '../static-props';

export type VariantRow = {
Expand All @@ -22,7 +22,7 @@ export type VariantTableData = ReturnType<typeof getVariantTableData>;
export function getVariantTableData(
variants: NlVariants | undefined,
namedDifference: NlNamedDifference,
variantColors: ColorMatch
variantColors: ColorMatches
) {
const emptyValues = {
variantTable: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { VariantChartValue } from '~/domain/variants/static-props';
import { SiteText } from '~/locale';
import { useList } from '~/utils/use-list';
import {
ColorMatch,
ColorMatches,
VariantCode,
VariantCodesAll,
} from '~/domain/variants/static-props';
Expand All @@ -32,7 +32,7 @@ type VariantsStackedAreaTileText = {
type VariantsStackedAreaTileProps = {
text: VariantsStackedAreaTileText;
values?: VariantChartValue[] | null;
variantColors: ColorMatch;
variantColors: ColorMatches;
metadata: MetadataProps;
children?: ReactNode;
noDataMessage?: ReactNode;
Expand Down Expand Up @@ -76,7 +76,7 @@ type VariantStackedAreaTileWithDataProps = {
text: VariantsStackedAreaTileText;
values: VariantChartValue[];
metadata: MetadataProps;
variantColors: ColorMatch;
variantColors: ColorMatches;
children?: ReactNode;
};

Expand Down Expand Up @@ -208,7 +208,7 @@ function useFilteredSeriesConfig(
function useSeriesConfig(
text: VariantsStackedAreaTileText,
values: VariantChartValue[],
variantColors: ColorMatch
variantColors: ColorMatches
) {
return useMemo(() => {
const baseVariantsFiltered = values
Expand Down

0 comments on commit 85b81ed

Please sign in to comment.