Skip to content

Commit

Permalink
Agrego logica de seleccion de colores ante ausencia de parametro colo…
Browse files Browse the repository at this point in the history
…r en CardRow
  • Loading branch information
pepeciavirella committed Dec 27, 2019
1 parent fba2fce commit 13d580d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/components/exportable/CardRowExportable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SerieApi, { METADATA } from "../../api/SerieApi";
import { ApiClient } from "../../api/ApiClient";
import { getAPIDefaultURI } from "../../helpers/previewCard/linkGenerators";
import QueryParams from "../../api/QueryParams";
import { getCardColor } from "../style/Colors/Color";
import { getCardColor, DEFAULT_COLORS } from "../style/Colors/Color";
import { DEFAULT_DECIMALS_BILLION, DEFAULT_DECIMALS_MILLION } from "../../helpers/common/LocaleValueFormatter";
import { ICardRowExportableConfig } from "../../indexCardRow";
import FullCard from "../exportable_card/FullCard";
Expand Down Expand Up @@ -140,12 +140,17 @@ export default class CardRowExportable extends React.Component<ICardRowExportabl
}
this.colors = this.props.color;
}
else {
else if (this.props.color !== undefined) {
const color = getCardColor(this.props.color);
for (let step = 0; step < this.idsAmount; step++) {
this.colors.push(color);
}
}
else {
for (let step = 0; step < this.idsAmount; step++) {
this.colors.push(DEFAULT_COLORS[step % DEFAULT_COLORS.length].code)
}
}

}

Expand Down
2 changes: 1 addition & 1 deletion src/components/style/Colors/Color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const COLORS = {
const hexaColorRegex = /^#[0-9a-f]{6}$/i;

export const DEFAULT_CARD_COLOR = "#0072BB";
const DEFAULT_COLORS = (Object as any).values(COLORS);
export const DEFAULT_COLORS = (Object as any).values(COLORS);

export default COLORS;

Expand Down

0 comments on commit 13d580d

Please sign in to comment.