import { Box, Tooltip } from '@material-ui/core'; import { blue, red, yellow } from '@material-ui/core/colors'; import RadioButtonCheckedIcon from '@material-ui/icons/RadioButtonChecked'; import { makeStyles } from '@material-ui/styles'; import React, { Component } from 'react'; import { withRouter } from 'react-router-dom'; class DeviceMarker extends Component { constructor(props) { super(props); this.state = { AnchorEl: null } } getColor() { const { device } = this.props; if (device.status === "Online") { return { color: blue[800] }; } else if (device.status === "Offline") { return { color: yellow[800] }; } else /* if (device.status == "unknown") */ { return { color: red[800] }; } } useStyles() { return makeStyles(theme => ({ root: { display: 'grid' }, icon: { } })); } render() { const classes = this.useStyles(this.props); const { device } = this.props; const onClick = () => { this.props.history.push('/devices/' + device.id) }; const open = Boolean(this.state.AnchorEl); return ( ID: {device.id}
Status: {device.status}} placement="top" leaveDelay={200} arrow>
); } } export default withRouter(DeviceMarker);