Skip to content

Commit

Permalink
Revert "Revert "Disable map recenter button when auto centering is on (
Browse files Browse the repository at this point in the history
  • Loading branch information
arkadyan committed Apr 16, 2020
1 parent e544fcf commit 5d5f7ab
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 20 deletions.
9 changes: 9 additions & 0 deletions assets/css/_vehicle_map.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,13 @@
stroke: $black;
stroke-width: 1.8;
}

.m-vehicle-map--auto-centering & a {
background-color: $color-button-disabled;
color: $color-font-grey;

path {
stroke: $color-font-grey;
}
}
}
6 changes: 5 additions & 1 deletion assets/src/components/map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,14 @@ const Map = (props: Props): ReactElement<HTMLDivElement> => {
setMapState({ map, markers, shapes })
}, [shouldAutoCenter, props, containerRef, appState])

const autoCenteringClass = shouldAutoCenter
? "m-vehicle-map--auto-centering"
: ""

return (
<div
id="id-vehicle-map"
className="m-vehicle-map"
className={`m-vehicle-map ${autoCenteringClass}`}
ref={(container) => (containerRef.current = container)}
/>
)
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/components/__snapshots__/map.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`map renders 1`] = `
<div
className="m-vehicle-map"
className="m-vehicle-map m-vehicle-map--auto-centering"
id="id-vehicle-map"
/>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ Array [
className="m-vehicle-properties-panel__map"
>
<div
className="m-vehicle-map"
className="m-vehicle-map m-vehicle-map--auto-centering"
id="id-vehicle-map"
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ exports[`SearchPage renders a selected vehicle 1`] = `
className="m-search-page__map"
>
<div
className="m-vehicle-map"
className="m-vehicle-map m-vehicle-map--auto-centering"
id="id-vehicle-map"
/>
</div>
Expand Down Expand Up @@ -396,7 +396,7 @@ exports[`SearchPage renders a selected vehicle 1`] = `
className="m-vehicle-properties-panel__map"
>
<div
className="m-vehicle-map"
className="m-vehicle-map m-vehicle-map--auto-centering"
id="id-vehicle-map"
/>
</div>
Expand Down Expand Up @@ -587,7 +587,7 @@ exports[`SearchPage renders the empty state 1`] = `
className="m-search-page__map"
>
<div
className="m-vehicle-map"
className="m-vehicle-map m-vehicle-map--auto-centering"
id="id-vehicle-map"
/>
</div>
Expand Down Expand Up @@ -765,7 +765,7 @@ exports[`SearchPage renders vehicle data 1`] = `
className="m-search-page__map"
>
<div
className="m-vehicle-map"
className="m-vehicle-map m-vehicle-map--auto-centering"
id="id-vehicle-map"
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ exports[`Shuttle Map Page renders 1`] = `
className="m-shuttle-map__map"
>
<div
className="m-vehicle-map"
className="m-vehicle-map m-vehicle-map--auto-centering"
id="id-vehicle-map"
/>
</div>
Expand Down Expand Up @@ -413,7 +413,7 @@ exports[`Shuttle Map Page renders a selected shuttle vehicle 1`] = `
className="m-shuttle-map__map"
>
<div
className="m-vehicle-map"
className="m-vehicle-map m-vehicle-map--auto-centering"
id="id-vehicle-map"
/>
</div>
Expand Down Expand Up @@ -609,7 +609,7 @@ exports[`Shuttle Map Page renders a selected shuttle vehicle 1`] = `
className="m-vehicle-properties-panel__map"
>
<div
className="m-vehicle-map"
className="m-vehicle-map m-vehicle-map--auto-centering"
id="id-vehicle-map"
/>
</div>
Expand Down Expand Up @@ -832,7 +832,7 @@ exports[`Shuttle Map Page renders selected shuttle routes 1`] = `
className="m-shuttle-map__map"
>
<div
className="m-vehicle-map"
className="m-vehicle-map m-vehicle-map--auto-centering"
id="id-vehicle-map"
/>
</div>
Expand Down Expand Up @@ -1042,7 +1042,7 @@ exports[`Shuttle Map Page renders with all shuttles selected 1`] = `
className="m-shuttle-map__map"
>
<div
className="m-vehicle-map"
className="m-vehicle-map m-vehicle-map--auto-centering"
id="id-vehicle-map"
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ exports[`VehiclePropertiesPanel renders a vehicle properties panel 1`] = `
className="m-vehicle-properties-panel__map"
>
<div
className="m-vehicle-map"
className="m-vehicle-map m-vehicle-map--auto-centering"
id="id-vehicle-map"
/>
</div>
Expand Down Expand Up @@ -444,7 +444,7 @@ exports[`VehiclePropertiesPanel renders for a headway-based vehicle 1`] = `
className="m-vehicle-properties-panel__map"
>
<div
className="m-vehicle-map"
className="m-vehicle-map m-vehicle-map--auto-centering"
id="id-vehicle-map"
/>
</div>
Expand Down Expand Up @@ -670,7 +670,7 @@ exports[`VehiclePropertiesPanel renders for a late vehicle 1`] = `
className="m-vehicle-properties-panel__map"
>
<div
className="m-vehicle-map"
className="m-vehicle-map m-vehicle-map--auto-centering"
id="id-vehicle-map"
/>
</div>
Expand Down Expand Up @@ -867,7 +867,7 @@ exports[`VehiclePropertiesPanel renders for a shuttle 1`] = `
className="m-vehicle-properties-panel__map"
>
<div
className="m-vehicle-map"
className="m-vehicle-map m-vehicle-map--auto-centering"
id="id-vehicle-map"
/>
</div>
Expand Down Expand Up @@ -1202,7 +1202,7 @@ exports[`VehiclePropertiesPanel renders for a vehicle with block waivers 1`] = `
className="m-vehicle-properties-panel__map"
>
<div
className="m-vehicle-map"
className="m-vehicle-map m-vehicle-map--auto-centering"
id="id-vehicle-map"
/>
</div>
Expand Down Expand Up @@ -1428,7 +1428,7 @@ exports[`VehiclePropertiesPanel renders for an early vehicle 1`] = `
className="m-vehicle-properties-panel__map"
>
<div
className="m-vehicle-map"
className="m-vehicle-map m-vehicle-map--auto-centering"
id="id-vehicle-map"
/>
</div>
Expand Down Expand Up @@ -1668,7 +1668,7 @@ exports[`VehiclePropertiesPanel renders for an off-course vehicle 1`] = `
className="m-vehicle-properties-panel__map"
>
<div
className="m-vehicle-map"
className="m-vehicle-map m-vehicle-map--auto-centering"
id="id-vehicle-map"
/>
</div>
Expand Down Expand Up @@ -1894,7 +1894,7 @@ exports[`VehiclePropertiesPanel renders with route data 1`] = `
className="m-vehicle-properties-panel__map"
>
<div
className="m-vehicle-map"
className="m-vehicle-map m-vehicle-map--auto-centering"
id="id-vehicle-map"
/>
</div>
Expand Down

0 comments on commit 5d5f7ab

Please sign in to comment.