Skip to content

Commit

Permalink
[feat] Apply new legend style (#2831)
Browse files Browse the repository at this point in the history
- pass through `className` to legend
- css updates to reflect new designs

Signed-off-by: Ihor Dykhta <dikhta.igor@gmail.com>
  • Loading branch information
igorDykhta authored Dec 10, 2024
1 parent f9c214d commit 639c7a5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/src/common/color-legend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const inputCss = css`
`;
const StyledLegend = styled.div<{disableEdit: boolean; isExpanded?: boolean}>`
${props => props.theme.sidePanelScrollBar};
${props => (props.isExpanded ? '' : `max-height: 180px;`)};
${props => (props.isExpanded ? '' : `max-height: 156px;`)};
overflow: auto;
margin-bottom: ${GAP}px;
display: grid;
Expand Down
8 changes: 5 additions & 3 deletions src/components/src/map/map-control-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type StyledMapControlPanelContentProps = {
const StyledMapControlPanelContent = styled.div.attrs({
className: 'map-control__panel-content'
})<StyledMapControlPanelContentProps>`
${props => props.theme.dropdownScrollBar};
${props => props.theme.sidePanelScrollBar};
max-height: 500px;
min-height: 100px;
min-width: ${props => props.theme.mapControl.width}px;
Expand Down Expand Up @@ -119,6 +119,7 @@ export type MapControlPanelProps = {
onToggleSplitMapViewport?: ActionHandler<typeof toggleSplitMapViewport>;
isViewportUnsyncAllowed?: boolean;
children?: React.ReactNode;
className?: string;
};

function MapControlPanelFactory() {
Expand All @@ -135,7 +136,8 @@ function MapControlPanelFactory() {
logoComponent,
mapState,
onToggleSplitMapViewport,
isViewportUnsyncAllowed
isViewportUnsyncAllowed,
className = 'map-control-panel'
}) => {
const {isViewportSynced, isZoomLocked} = mapState || {};
const onUnlockViewportChange = useCallback(() => {
Expand All @@ -148,11 +150,11 @@ function MapControlPanelFactory() {

return (
<StyledMapControlPanel
className="map-control-panel"
style={{
transform: `scale(${scale})`,
marginBottom: '8px !important'
}}
className={className}
>
{mapState?.isSplit && isViewportUnsyncAllowed ? (
<StyledMapControlPanelHeaderSplitViewportsTools>
Expand Down
5 changes: 4 additions & 1 deletion src/components/src/map/map-legend-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export type MapLegendPanelProps = {
isViewportUnsyncAllowed?: boolean;
onClickControlBtn?: (e?: MouseEvent) => void;
onLayerVisConfigChange?: (oldLayer: Layer, newVisConfig: Partial<LayerVisConfig>) => void;
className: string;
};

function MapLegendPanelFactory(MapControlTooltip, MapControlPanel, MapLegend) {
Expand All @@ -93,6 +94,7 @@ function MapLegendPanelFactory(MapControlTooltip, MapControlPanel, MapLegend) {
onToggleSplitMapViewport,
onClickControlBtn,
isViewportUnsyncAllowed = true,
className,
onLayerVisConfigChange
}) => {
const mapLegend = mapControls?.mapLegend || ({} as MapControlMapLegend);
Expand Down Expand Up @@ -139,7 +141,7 @@ function MapLegendPanelFactory(MapControlTooltip, MapControlPanel, MapLegend) {
const mapControlPanel = (
<MapControlPanel
scale={scale}
header={'header.layerLegend'}
header="header.layerLegend"
isPinned={true}
{...(isPinned
? {
Expand All @@ -157,6 +159,7 @@ function MapLegendPanelFactory(MapControlTooltip, MapControlPanel, MapLegend) {
mapState={mapState}
onToggleSplitMapViewport={onToggleSplitMapViewport}
isViewportUnsyncAllowed={isViewportUnsyncAllowed}
className={className}
>
<MapLegend
layers={layers}
Expand Down

0 comments on commit 639c7a5

Please sign in to comment.