Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

migrate toolbar to react/redux #1576

Benjamin Kinged87a20754de
diff --git a/web/css/toolbar.css b/web/css/toolbar.css
index a097400fc..938ebb675 100644
--- a/web/css/toolbar.css
+++ b/web/css/toolbar.css
@@ -1,4 +1,4 @@
-#wv-toolbar {
+.wv-toolbar {
position: absolute;
right: 10px;
top: 10px;
@@ -6,59 +6,17 @@
border-radius: 0;
}
-#wv-toolbar li {
+.wv-toolbar .wv-toolbar-button {
font-size: 14.3px;
display: inline-block;
margin: 0 0 0 4px;
background: rgba(40, 40, 40, 0.85);
border: 1px solid #333;
- border-radius: 5px;
-}
-
-#wv-toolbar li label {
- border-radius: 5px;
- margin: 0;
- border: 0;
padding: 5.72px 14.3px;
- background-color: transparent;
- background-image: none;
-}
-
-#wv-toolbar li label span {
- display: inline-block;
- width: 0;
- padding: 0;
- line-height: normal;
-}
-
-#wv-toolbar li .ui-state-default {
- background-color: transparent;
- background-image: none;
+ border-radius: 5px;
}
-
-#wv-toolbar li:hover label {
+.wv-toolbar .wv-toolbar-button:hover {
background-color: #fff;
color: #1a1a1a;
}
-#wv-toolbar li:hover label.ui-state-disabled {
- background-color: transparent;
-}
-.wv-menu .ui-menu .ui-menu-item a {
- position: relative;
- border: 0;
- margin: 0;
- text-decoration: none;
- display: block;
- padding: 2px 0.4em 2px 2em;
- line-height: 1.5;
- min-height: 0;
- font-weight: 400;
-}
-.wv-menu .ui-menu .ui-menu-item .ui-state-active,
-.wv-menu .ui-menu .ui-menu-item a:hover,
-.wv-menu .ui-menu .ui-menu-item a:focus {
- color: #333;
- background: #eee;
- border: 0;
-}
diff --git a/web/js/containers/toolbar.js b/web/js/containers/toolbar.js
index 16aa33d75..33ddb9605 100644
--- a/web/js/containers/toolbar.js
+++ b/web/js/containers/toolbar.js
@@ -2,28 +2,53 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { openCustomContent } from '../modules/modal/actions';
+import { ButtonToolbar, Button } from 'reactstrap';
class LinksContainer extends Component {
render() {
const { openModal } = this.props;
return (
- <ul id="wv-toolbar">
- <li id="wv-link-button" className="wv-toolbar-button" />
- <li id="wv-proj-button" className="wv-toolbar-button" />
- <li
+ <ButtonToolbar id="wv-toolbar" className="wv-toolbar">
+ <Button
+ id="wv-link-button"
+ className="wv-toolbar-button"
+ title="Share this map"
+ onClick={() => openModal('TOOLBAR_SHARE_LINK')}
+ >
+ <i className="fas fa-share-square fa-2x" />
+ </Button>
+ <Button
+ id="wv-proj-button"
+ className="wv-toolbar-button"
+ title="Switch projection"
+ onClick={() => openModal('TOOLBAR_PROJECTION')}
+ >
+ <i className="fas fa-globe-asia fa-2x" />{' '}
+ </Button>
+ <Button
id="wv-image-button"
className="wv-toolbar-button"
- onClick={openModal}
- />
- <li id="wv-info-button" className="wv-toolbar-button wv-status-hide" />
- </ul>
+ title="Take a snapshot"
+ onClick={() => openModal('TOOLBAR_SNAPSHOT')}
+ >
+ <i className="fa fa-camera fa-2x" />{' '}
+ </Button>
+ <Button
+ id="wv-info-button"
+ title="Information"
+ className="wv-toolbar-button wv-status-hide"
+ onClick={() => openModal('TOOLBAR_INFO')}
+ >
+ <i className="fa fa-info-circle fa-2x" />{' '}
+ </Button>
+ </ButtonToolbar>
);
}
}
const mapDispatchToProps = dispatch => ({
- openModal: () => {
- dispatch(openCustomContent('TOOLBAR-SNAPSHOT_MODAL'));
+ openModal: text => {
+ dispatch(openCustomContent(text));
}
});
@@ -31,3 +56,7 @@ export default connect(
null,
mapDispatchToProps
)(LinksContainer);
+
+LinksContainer.propTypes = {
+ openModal: PropTypes.func
+};