Skip to content

Commit 7a2275b

Browse files
committed
GeoSankey: persist fullscreen in fs URL param for iframe embeds
1 parent 19605ff commit 7a2275b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

www/src/components/GeoSankey.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,10 @@ function GeoSankeyInner({ data }: Props) {
755755
'24hr': '24hr',
756756
}
757757

758-
const [fullscreen, setFullscreen] = useState(false)
758+
const [fullscreen, setFullscreen] = useUrlState('fs', {
759+
encode: (v: boolean) => v ? '1' : undefined,
760+
decode: (s: string | undefined) => s === '1',
761+
})
759762
const mapFocusedRef = useRef(false)
760763
const [mapFocused, setMapFocused] = useState(false)
761764
const mapContainerRef = useRef<HTMLDivElement>(null)
@@ -1251,7 +1254,7 @@ function GeoSankeyInner({ data }: Props) {
12511254
style={{ background: 'none', border: 'none', cursor: 'pointer', padding: '0 2px', color: '#aaa', fontSize: '13px', lineHeight: 1 }}
12521255
>{inlineLegend ? '☰' : '📍'}</button>
12531256
<button
1254-
onClick={() => setFullscreen(f => !f)}
1257+
onClick={() => setFullscreen(!fullscreen)}
12551258
title={fullscreen ? 'Exit fullscreen (Esc)' : 'Fullscreen'}
12561259
style={{ background: 'none', border: 'none', cursor: 'pointer', padding: '0 2px', color: '#aaa', fontSize: '13px', lineHeight: 1 }}
12571260
>{fullscreen ? '✕' : '⛶'}</button>

0 commit comments

Comments
 (0)