Skip to content

Commit

Permalink
Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelSzmarowski committed Sep 19, 2023
1 parent 2c89bb6 commit 1b68c69
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions packages/visualizations/src/components/MapPoi/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,31 @@ export const getMapLayers = (layers?: Layer[]): CircleLayerSpecification[] => {
if (!layers) return [];

return layers.map((layer) => {
let circleColor: DataDrivenPropertyValueSpecification<Color> | Color = layer.color;
// Border color is optionnal in map layers
const {
id,
type,
source,
sourceLayer,
circleRadius = 7,
circleStrokeWidth = 1.5,
colorMatch,
color: layerColor,
borderColor: layerBorderColor,
} = layer;

let circleColor: DataDrivenPropertyValueSpecification<Color> | Color = layerColor;
let circleBorderColor: DataDrivenPropertyValueSpecification<Color> | Color | undefined =
layer?.borderColor;
layerBorderColor;

if (layer.colorMatch) {
const { key, colors, borderColors } = layer.colorMatch;
if (colorMatch) {
const { key, colors, borderColors } = colorMatch;
const groupByColors = ['match', ['get', key]];
Object.keys(colors).forEach((color) => {
groupByColors.push(color, colors[color]);
});
groupByColors.push(layer.color);
groupByColors.push(layerColor);
circleColor = groupByColors;

// Border colors are optionnal in the colorMatch props
if (borderColors) {
const groupBordersByColors = ['match', ['get', key]];
Object.keys(borderColors).forEach((borderColor) => {
Expand All @@ -54,9 +64,6 @@ export const getMapLayers = (layers?: Layer[]): CircleLayerSpecification[] => {
circleBorderColor = groupBordersByColors;
}
}
const {
id, type, source, sourceLayer, circleRadius = 7, circleStrokeWidth = 1.5
} = layer;
return {
id,
type,
Expand Down

0 comments on commit 1b68c69

Please sign in to comment.