@@ -5,24 +5,52 @@ import type { MapViewState } from '@deck.gl/core';
55import { Button } from '@/components/ui/button' ;
66
77type Props = {
8+ showAllLabels : boolean ;
89 viewState : MapViewState ;
910 mapStyle : 'dark' | 'satellite' ;
1011 hasPanel : boolean ;
1112 timelineVisible ?: boolean ;
1213 isMobile ?: boolean ;
14+ onShowAllLabelsChange : ( show : boolean ) => void ;
1315 onStyleChange : ( s : 'dark' | 'satellite' ) => void ;
1416} ;
1517
16- export function MapControls ( { viewState, mapStyle, hasPanel, timelineVisible = true , isMobile = false , onStyleChange } : Props ) {
18+ export function MapControls ( {
19+ viewState,
20+ mapStyle,
21+ hasPanel,
22+ timelineVisible = true ,
23+ isMobile = false ,
24+ onShowAllLabelsChange,
25+ onStyleChange,
26+ showAllLabels,
27+ } : Props ) {
1728 const right : number | string = isMobile ? 'max(12px, var(--safe-right))' : ( hasPanel ? 332 : 12 ) ;
1829 const bottomOffset = timelineVisible ? 0 : - 44 ;
1930 const coordBottom = isMobile ? 64 + bottomOffset : 56 + bottomOffset ;
20- const switcherBottom = isMobile ? 94 + bottomOffset : 86 + bottomOffset ;
31+ const switcherBottom = isMobile ? 126 + bottomOffset : 118 + bottomOffset ;
2132 const coordBottomStyle = isMobile ? `calc(${ coordBottom } px + var(--safe-bottom))` : coordBottom ;
2233 const switcherBottomStyle = isMobile ? `calc(${ switcherBottom } px + var(--safe-bottom))` : switcherBottom ;
2334
2435 return (
2536 < >
37+ < Button
38+ variant = "ghost"
39+ size = "xs"
40+ onClick = { ( ) => onShowAllLabelsChange ( ! showAllLabels ) }
41+ className = { `mono absolute z-10 h-auto rounded-sm px-2.5 py-1 font-bold ${ isMobile ? 'text-[9px]' : 'text-[8px]' } ` }
42+ style = { {
43+ background : showAllLabels ? 'var(--blue-dim)' : 'rgba(28,33,39,0.92)' ,
44+ border : '1px solid var(--bd)' ,
45+ bottom : isMobile ? `calc(${ switcherBottom + 32 } px + var(--safe-bottom))` : switcherBottom + 30 ,
46+ color : showAllLabels ? 'var(--blue-l)' : 'var(--t3)' ,
47+ right,
48+ transition : 'right 0.22s cubic-bezier(0.4,0,0.2,1), bottom 0.22s cubic-bezier(0.4,0,0.2,1)' ,
49+ } }
50+ >
51+ LABELS { showAllLabels ? 'ALL' : 'SMART' }
52+ </ Button >
53+
2654 { /* Map style switcher */ }
2755 < div className = "absolute flex overflow-hidden rounded-sm z-10"
2856 style = { { bottom : switcherBottomStyle , right, border : '1px solid var(--bd)' , transition : 'right 0.22s cubic-bezier(0.4,0,0.2,1), bottom 0.22s cubic-bezier(0.4,0,0.2,1)' } } >
0 commit comments