@@ -56,14 +80,15 @@ export function MapBottomDrawer({
className="map-bottom-drawer-button"
title={fullHeight ? 'Collapse' : 'Expand'}
>
- {fullHeight ? (
-
- ) : (
-
- )}
+
-
{title}
+
{getTitle(contentType)}
- {isExpanded && children}
+ {isExpanded && (
+ <>
+ {isDataLayersVisible && }
+ {isSearchByVisible && }
+ {isFilterByVisible && }
+ {/* Add more contents like point/polygon search */}
+ {isSearchResultsVisible && (
+
+ )}
+ >
+ )}
)
diff --git a/frontend/src/pages/map/drawer/MapDrawer.tsx b/frontend/src/pages/map/drawer/MapDrawer.tsx
index 11817a62..4b1e46dd 100644
--- a/frontend/src/pages/map/drawer/MapDrawer.tsx
+++ b/frontend/src/pages/map/drawer/MapDrawer.tsx
@@ -2,11 +2,14 @@ import { useDispatch } from 'react-redux'
import { useTheme } from '@mui/material/styles'
import useMediaQuery from '@mui/material/useMediaQuery'
-import { setDrawerExpanded } from '@/features/map/map-slice'
+import {
+ setBottomDrawerContent,
+ setDrawerExpanded,
+} from '@/features/map/map-slice'
import { useMapDrawerState } from '../hooks/useMapDrawerState'
import { MapBottomDrawer } from './MapBottomDrawer'
import { MapSidebar } from './MapSidebar'
-import { SearchResultsList } from './SearchResultsList'
+import { useCalculateSidebarWidth } from '../hooks/useCalculateSidebarWidth'
import './MapDrawer.css'
@@ -16,6 +19,9 @@ export function MapDrawer() {
// If the screen width is small or medium - shown drawer below
const isSmallScreen = useMediaQuery(theme.breakpoints.down('lg'))
const { isVisible, isDrawerExpanded } = useMapDrawerState(isSmallScreen)
+ // This hook calculates the sidebar width based on screen size
+ // and sets the sidebarWidth state which other components use
+ useCalculateSidebarWidth()
if (!isVisible) {
return null
@@ -23,23 +29,14 @@ export function MapDrawer() {
const setExpanded = (expanded: boolean) => {
dispatch(setDrawerExpanded(expanded))
+ if (isSmallScreen && !expanded) {
+ dispatch(setBottomDrawerContent(undefined))
+ }
}
- return (
- <>
- {isSmallScreen ? (
-