diff options
| author | Andrej Mihajlov <and@codeispoetry.ru> | 2017-02-24 12:28:54 +0000 |
|---|---|---|
| committer | Andrej Mihajlov <and@codeispoetry.ru> | 2017-02-24 12:28:54 +0000 |
| commit | 040c1ef18fec5ab1aac5bfef4fc596f0c4591e9f (patch) | |
| tree | 3203c5d90880a56c63a25dca38c73bec6b324b1b /app | |
| parent | 17044039439f9ea0da15e5e529aca0b7d06638ec (diff) | |
| download | mullvadvpn-040c1ef18fec5ab1aac5bfef4fc596f0c4591e9f.tar.xz mullvadvpn-040c1ef18fec5ab1aac5bfef4fc596f0c4591e9f.zip | |
Switch marker based on connection status
Diffstat (limited to 'app')
| -rw-r--r-- | app/components/Connect.js | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/app/components/Connect.js b/app/components/Connect.js index d6fa51f716..7eeec2eac9 100644 --- a/app/components/Connect.js +++ b/app/components/Connect.js @@ -1,7 +1,7 @@ import React, { Component, PropTypes } from 'react'; import { If, Then } from 'react-if'; import cheapRuler from 'cheap-ruler'; -import ReactMapboxGl, { Layer, Feature } from 'react-mapbox-gl'; +import ReactMapboxGl, { Marker } from 'react-mapbox-gl'; import { Layout, Container, Header } from './Layout'; import { servers, ConnectionState } from '../constants'; @@ -107,6 +107,15 @@ export default class Connect extends Component { return [ bbox[1], bbox[0], bbox[3], bbox[2] ]; // <lng>, <lat>, <lng>, <lat> } + markerImage() { + switch(this.props.connect.status) { + case ConnectionState.connected: + return './assets/images/location-marker-secure.svg'; + default: + return './assets/images/location-marker-unsecure.svg'; + } + } + componentWillMount() { const loc = this.displayLocation(); @@ -144,9 +153,9 @@ export default class Connect extends Component { interactive={ false } fitBounds={ this.getBounds(displayLocation) } fitBoundsOptions={ {offset: [0, -100]} }> - <Layer type="symbol" id="marker" layout={{ 'icon-image': 'marker-15' }}> - <Feature coordinates={ markerLocation } /> - </Layer> + <Marker coordinates={ markerLocation } offset={ [0, -10] }> + <img src={ this.markerImage() } /> + </Marker> </ReactMapboxGl> </div> <div className="connect__container"> |
