Skip to content

Commit

Permalink
feat: drop zoom out button
Browse files Browse the repository at this point in the history
  • Loading branch information
benfurber committed Jan 8, 2025
1 parent 1cbc0d3 commit 58b3eb9
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 42 deletions.
8 changes: 0 additions & 8 deletions packages/cypress/src/integration/map.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,6 @@ describe('[Map]', () => {
cy.intercept(urlLondon).as('londonSearch')
cy.wait('@londonSearch')
cy.contains('London, Greater London, England, United Kingdom').click()

cy.step('WorldViewButton enabled when zoomed in')
cy.get('[data-cy=WorldViewButton').click()
cy.wait(1000)
cy.get('[data-cy=WorldViewButton-disabled')

cy.step('LocationViewButton visable and clickable')
cy.get('[data-cy="LocationViewButton"]').click()
})

it("Doesn't show member pins when config is set", () => {
Expand Down
2 changes: 0 additions & 2 deletions src/pages/Maps/Content/MapView/MapContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ export const MapContainer = (props: IProps) => {
<MapView
allPins={filteredPins}
center={center}
initialCenter={INITIAL_CENTER}
initialZoom={INITIAL_ZOOM}
mapRef={mapRef}
setBoundaries={setBoundaries}
setZoom={setZoom}
Expand Down
32 changes: 0 additions & 32 deletions src/pages/Maps/Content/MapView/MapView.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useEffect } from 'react'
import { Tooltip } from 'react-tooltip'
import { Button, Map } from 'oa-components'
import { Box, Flex } from 'theme-ui'

Expand All @@ -15,8 +14,6 @@ import type { Map as MapType, MapProps } from 'react-leaflet'
interface IProps {
allPins: IMapPin[] | null
center: ILatLng
initialCenter: ILatLng
initialZoom: number
mapRef: RefObject<MapType<MapProps, any>>
onBlur: () => void
onPinClick: (IMapPin) => void
Expand All @@ -28,14 +25,10 @@ interface IProps {
zoom: number
}

const ZOOM_OUT_TOOLTIP = 'Zoom out to world view'

export const MapView = (props: IProps) => {
const {
allPins,
center,
initialCenter,
initialZoom,
mapRef,
onBlur,
onPinClick,
Expand All @@ -47,15 +40,6 @@ export const MapView = (props: IProps) => {
zoom,
} = props

const buttonStyle = {
backgroundColor: 'white',
borderRadius: 99,
padding: 4,
':hover': {
backgroundColor: 'lightgray',
},
}

const handleLocationChange = () => {
if (mapRef.current) {
const boundaries = mapRef.current.leafletElement.getBounds()
Expand All @@ -73,8 +57,6 @@ export const MapView = (props: IProps) => {
}
}, [mapRef])

const isWorldViewButtonDisabled = zoom === initialZoom

return (
<Map
ref={mapRef}
Expand Down Expand Up @@ -104,20 +86,6 @@ export const MapView = (props: IProps) => {
}}
>
<ButtonZoomIn setCenter={setCenter} setZoom={setZoom} />

<Button
data-tooltip-content={ZOOM_OUT_TOOLTIP}
data-cy={`WorldViewButton${isWorldViewButtonDisabled ? '-disabled' : ''}`}
data-tooltip-id="worldViewButton-tooltip"
sx={buttonStyle}
onClick={() => {
setCenter(initialCenter)
setZoom(initialZoom)
}}
disabled={isWorldViewButtonDisabled}
icon="globe"
/>
<Tooltip id="worldViewButton-tooltip" place="top" />
</Box>

<Flex
Expand Down

0 comments on commit 58b3eb9

Please sign in to comment.