@@ -358,6 +358,8 @@ type LegendProps = {
358358} ;
359359
360360function Legend ( { parkOnly } : LegendProps ) {
361+ const [ collapsed , setCollapsed ] = useState ( false ) ;
362+
361363 const items = parkOnly
362364 ? [
363365 { color : '#c8eaad' , label : 'Parks' } ,
@@ -387,14 +389,43 @@ function Legend({ parkOnly }: LegendProps) {
387389 fontSize : 12 ,
388390 lineHeight : 1.7 ,
389391 boxShadow : '0 2px 8px rgba(0,0,0,0.2)' ,
390- pointerEvents : 'none' ,
391392 minWidth : 160 ,
392393 } }
393394 >
394- < div style = { { fontWeight : 700 , marginBottom : 6 , color : '#2d5a27' , fontSize : 13 } } >
395- Grüne Karte Karlsruhe
396- </ div >
397- { items . map ( ( { color, label } ) => (
395+ < button
396+ type = "button"
397+ onClick = { ( ) => setCollapsed ( ( c ) => ! c ) }
398+ aria-expanded = { ! collapsed }
399+ aria-label = { collapsed ? 'Legende aufklappen' : 'Legende zuklappen' }
400+ style = { {
401+ display : 'flex' ,
402+ alignItems : 'center' ,
403+ justifyContent : 'space-between' ,
404+ gap : 8 ,
405+ marginBottom : collapsed ? 0 : 6 ,
406+ width : '100%' ,
407+ background : 'none' ,
408+ border : 'none' ,
409+ padding : 0 ,
410+ cursor : 'pointer' ,
411+ color : '#2d5a27' ,
412+ textAlign : 'left' ,
413+ } }
414+ >
415+ < span style = { { fontWeight : 700 , fontSize : 13 } } >
416+ Grüne Karte Karlsruhe
417+ </ span >
418+ { collapsed ? (
419+ < svg width = "14" height = "14" viewBox = "0 0 14 14" fill = "none" xmlns = "http://www.w3.org/2000/svg" >
420+ < path d = "M2.5 5L7 9.5L11.5 5" stroke = "currentColor" strokeWidth = "1.8" strokeLinecap = "round" strokeLinejoin = "round" />
421+ </ svg >
422+ ) : (
423+ < svg width = "14" height = "14" viewBox = "0 0 14 14" fill = "none" xmlns = "http://www.w3.org/2000/svg" >
424+ < path d = "M2.5 9L7 4.5L11.5 9" stroke = "currentColor" strokeWidth = "1.8" strokeLinecap = "round" strokeLinejoin = "round" />
425+ </ svg >
426+ ) }
427+ </ button >
428+ { ! collapsed && items . map ( ( { color, label } ) => (
398429 < div key = { label } style = { { display : 'flex' , alignItems : 'center' , gap : 8 } } >
399430 < div
400431 style = { {
0 commit comments