From f29c31c854a4f506d04f6647d717f85ad2579068 Mon Sep 17 00:00:00 2001 From: Alejandro Sanchez Date: Tue, 29 Oct 2024 21:01:18 -0700 Subject: [PATCH] Fix faulty logic when closing property info panel --- .../mapSideBar/layout/MapSideBarLayout.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/source/frontend/src/features/mapSideBar/layout/MapSideBarLayout.tsx b/source/frontend/src/features/mapSideBar/layout/MapSideBarLayout.tsx index c1ad9e2200..792c8858c6 100644 --- a/source/frontend/src/features/mapSideBar/layout/MapSideBarLayout.tsx +++ b/source/frontend/src/features/mapSideBar/layout/MapSideBarLayout.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useCallback } from 'react'; import { Col, Row } from 'react-bootstrap'; import styled from 'styled-components'; @@ -22,8 +22,15 @@ export interface IMapSideBarLayoutProps { */ const MapSideBarLayout: React.FunctionComponent< React.PropsWithChildren -> = ({ title, header, icon, showCloseButton, ...props }) => { +> = ({ title, header, icon, showCloseButton, onClose, ...props }) => { const { mapSideBarViewState, toggleSidebarDisplay } = useMapStateMachine(); + + const close = useCallback(() => { + if (typeof onClose === 'function') { + onClose(); + } + }, [onClose]); + return ( {mapSideBarViewState.isCollapsed ? ( @@ -46,7 +53,7 @@ const MapSideBarLayout: React.FunctionComponent< {showCloseButton && ( - + )} @@ -79,7 +86,7 @@ const MapSideBarLayout: React.FunctionComponent< {showCloseButton && ( - + )}