9
9
import React from 'react' ;
10
10
import { connect } from 'react-redux' ;
11
11
12
- import classnames from 'classnames' ;
13
12
import PropTypes from 'prop-types' ;
14
13
15
14
import { setCurrentTask } from '../actions/task' ;
16
- import Icon from '../components/Icon ' ;
15
+ import MapButton from '../components/MapButton ' ;
17
16
import ConfigUtils from '../utils/ConfigUtils' ;
18
17
import LocaleUtils from "../utils/LocaleUtils" ;
19
18
import ThemeUtils from '../utils/ThemeUtils' ;
@@ -26,7 +25,6 @@ class TaskButton extends React.Component {
26
25
currentTask : PropTypes . string ,
27
26
/** The icon name. */
28
27
icon : PropTypes . string ,
29
- mapMargins : PropTypes . object ,
30
28
/** The task mode. */
31
29
mode : PropTypes . string ,
32
30
/** The position slot index of the map button, from the bottom (0: bottom slot). */
@@ -47,22 +45,10 @@ class TaskButton extends React.Component {
47
45
if ( ! ThemeUtils . themeFlagsAllowed ( this . props . theme , this . props . themeFlagWhitelist , this . props . themeFlagBlacklist ) ) {
48
46
return null ;
49
47
}
50
- const right = this . props . mapMargins . right ;
51
- const bottom = this . props . mapMargins . bottom ;
52
- const style = {
53
- right : 'calc(1.5em + ' + right + 'px)' ,
54
- bottom : 'calc(var(--bottombar-height) + ' + bottom + 'px + ' + ( 3 + 4 * this . props . position ) + 'em)'
55
- } ;
56
- const classes = classnames ( {
57
- "map-button" : true ,
58
- "map-button-active" : this . props . currentTask === this . props . task
59
- } ) ;
60
48
const title = LocaleUtils . tr ( "appmenu.items." + this . props . task + ( this . props . mode || "" ) ) ;
61
49
return (
62
- < button className = { classes } onClick = { this . buttonClicked }
63
- style = { style } title = { title } >
64
- < Icon icon = { this . props . icon } />
65
- </ button >
50
+ < MapButton icon = { this . props . icon } onClick = { this . buttonClicked }
51
+ position = { this . props . position } tooltip = { title } />
66
52
) ;
67
53
}
68
54
buttonClicked = ( ) => {
@@ -73,7 +59,6 @@ class TaskButton extends React.Component {
73
59
74
60
const selector = ( state ) => ( {
75
61
currentTask : state . task . id ,
76
- mapMargins : state . windows . mapMargins ,
77
62
theme : state . theme . current
78
63
} ) ;
79
64
0 commit comments