Skip to content

Commit

Permalink
remove unused
Browse files Browse the repository at this point in the history
  • Loading branch information
barbalex committed Jul 14, 2023
1 parent c960f98 commit 66ea332
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 25 deletions.
18 changes: 8 additions & 10 deletions src/components/Projekte/Karte/FullscreenControl.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React, { useCallback, useEffect, useState } from 'react'
import 'leaflet'
import styled from '@emotion/styled'
import { FaExpandArrowsAlt, FaCompressArrowsAlt } from 'react-icons/fa'
import screenfull from 'screenfull'

const StyledButton = styled.button`
const Button = styled.button`
background-color: white;
width: 34px;
height: 34px;
Expand All @@ -23,29 +22,28 @@ const StyledButton = styled.button`

const FullscreenControl = ({ mapRef }) => {
const [isFullscreen, setIsFullscreen] = useState(false)
const onChange = useCallback(
const onFullscreenChange = useCallback(
() => setIsFullscreen(screenfull.isFullscreen),
[],
)
useEffect(() => {
screenfull.on('change', onChange)

return () => screenfull.off('change', onChange)
}, [onChange])
screenfull.on('change', onFullscreenChange)
return () => screenfull.off('change', onFullscreenChange)
}, [onFullscreenChange])

const onClick = useCallback(() => {
if (screenfull.isEnabled) {
screenfull?.toggle?.(mapRef.current)
screenfull.toggle(mapRef.current)
}
}, [mapRef])

return (
<StyledButton
<Button
onClick={onClick}
title={isFullscreen ? 'Karte verkleinern' : 'Karte maximieren'}
>
{isFullscreen ? <FaCompressArrowsAlt /> : <FaExpandArrowsAlt />}
</StyledButton>
</Button>
)
}

Expand Down
Binary file removed src/components/Projekte/Karte/iconFullscreen.png
Binary file not shown.
Binary file removed src/components/Projekte/Karte/iconFullscreen2x.png
Binary file not shown.
15 changes: 0 additions & 15 deletions src/components/Projekte/Karte/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ import DrawControl from './DrawControl'
import PrintControl from './PrintControl'
import OwnControls from './OwnControls'
import CoordinatesControl from './CoordinatesControl'
import iconFullscreen from './iconFullscreen.png'
import iconFullscreen2x from './iconFullscreen2x.png'
import ErrorBoundary from '../../shared/ErrorBoundary'
import MapFilterListener from './MapFilterListener'
import ClickListener from './ClickListener'
Expand Down Expand Up @@ -361,19 +359,6 @@ const StyledMapContainer = styled(MapContainer)`
background: rgba(255, 255, 255, 0.9) !important;
}
/*
* leaflet.fullscreen
*/
.fullscreen-icon {
background-image: url(${iconFullscreen});
}
.leaflet-retina .fullscreen-icon {
background-image: url(${iconFullscreen2x});
background-size: 26px 26px;
}
/* one selector per rule as explained here : https://www.sitepoint.com/html5-full-screen-api/ */
.leaflet-container:-webkit-full-screen {
Expand Down

0 comments on commit 66ea332

Please sign in to comment.