Skip to content

Commit

Permalink
fix(legend): fix legend order closes2273 (#2311)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaminderpal authored Jun 26, 2024
1 parent 6a1bf93 commit e5d7d14
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/geoview-core/src/core/components/legend/legend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { getSxClasses } from './legend-styles';
import { LegendLayer } from './legend-layer';
import { TypeLegendLayer } from '@/core/components/layers/types';
import { useFooterPanelHeight } from '@/core/components/common';
import { CONTAINER_TYPE } from '@/core/utils/constant';

interface LegendType {
fullWidth?: boolean;
Expand Down Expand Up @@ -44,6 +45,8 @@ export function Legend({ fullWidth, containerType = 'footerBar' }: LegendType):
const getLegendLayerListSize = useMemo(() => {
return () => {
let size = 4;
// when legend is loaded in appbar size will always be 1.
if (containerType === CONTAINER_TYPE.APP_BAR) return 1;
if (window.innerWidth < theme.breakpoints.values.sm) {
size = 1;
} else if (window.innerWidth < theme.breakpoints.values.md) {
Expand All @@ -53,7 +56,7 @@ export function Legend({ fullWidth, containerType = 'footerBar' }: LegendType):
}
return size;
};
}, [theme.breakpoints.values.lg, theme.breakpoints.values.md, theme.breakpoints.values.sm]);
}, [theme.breakpoints.values.lg, theme.breakpoints.values.md, theme.breakpoints.values.sm, containerType]);

/**
* Transform the list of the legends into subsets of lists.
Expand Down

0 comments on commit e5d7d14

Please sign in to comment.