diff --git a/src/components/Panel.jsx b/src/components/Panel.jsx index b5e1b33..5d7fac8 100644 --- a/src/components/Panel.jsx +++ b/src/components/Panel.jsx @@ -23,6 +23,21 @@ const StyledTabList = styled(TabList)` } `; +const ToggleButton = styled.button` + background: none; + border: none; + cursor: pointer; + padding: 0.5rem; + margin: 0.5rem; + &:focus { + outline: none; + } + @media (max-width: 768px) { + padding: 1rem; + margin: 0.25rem; + } +`; + export default function Panel() { const { isPlaying, playVideo, pauseVideo } = useContext(VideoContext); const { mapView } = useContext(MapViewContext); @@ -32,6 +47,7 @@ export default function Panel() { const { chartData } = useContext(ChartDataContext); const [selectedIndex, setSelectedIndex] = useState(0); + const [isCollapsed, setIsCollapsed] = useState(false); const handlePlayPause = () => { if (isPlaying) { @@ -65,110 +81,45 @@ export default function Panel() { }; useEffect(() => { - if (mapView) { - const initialLayer = config[0]; - changeLayer(initialLayer, 0); - } - }, [mapView]); - - const getMaxValuesForYears = useMemo(() => { - const years = [2000, 2025, 2050, 2075, 2100]; - const selectedVariable = selectedIndex === 0 ? 'heatmax_ssp126' : selectedIndex === 1 ? 'heatmax_ssp245' : 'heatmax_ssp370'; - - return years.map((year) => { - const dataForYear = chartData.find(data => data.x === String(year)); - return dataForYear ? Math.round(dataForYear[selectedVariable]) : 'N/A'; - }); - }, [chartData, selectedIndex]); - + // Add any necessary effect logic here + }, []); return ( -
- - - {config.map((dataset, index) => ( - - `px-4 py-2 text-xs rounded-sm focus:outline-none ${ - selected ? 'bg-blue-600 text-white' : 'bg-black bg-opacity-90 text-white' - }` - } - onClick={() => changeLayer(dataset, index)} - > - {dataset.name} - - ))} - - - - {config.map((dataset, index) => ( - -
- -
-

Heat Index

- -
-
- -
- -
- {isPlaying ? ( - - ) : ( - - )} -
- -
- -
-
-
- -
- °C - - - - - - °F - -
- {getMaxValuesForYears.map((value, idx) => ( -
- {value === 'N/A' ? ( -
- ) : ( - {value} {isFahrenheit ? '°F' : '°C'} - )} -
- ))} -
-
- -
- -
-
+
+ setIsCollapsed(!isCollapsed)}> + {isCollapsed ? 'Expand' : 'Collapse'} + + {!isCollapsed && ( + <> + + Tab 1 + Tab 2 + Tab 3 + + + + + + +
Content for Tab 2
+
+ +
Content for Tab 3
- ))} -
- + +
+ + + +
+ + )}
); }