import React from 'react'; import { connect } from 'react-redux'; import classNames from 'classnames'; import { enterEdge, leaveEdge } from '../actions/app-actions'; class Edge extends React.Component { constructor(props, context) { super(props, context); this.handleMouseEnter = this.handleMouseEnter.bind(this); this.handleMouseLeave = this.handleMouseLeave.bind(this); } render() { const { id, path, highlighted, blurred, focused, thickness, source, target } = this.props; const shouldRenderMarker = (focused || highlighted) && (source !== target); const className = classNames('edge', { highlighted, blurred }); return ( ); } handleMouseEnter(ev) { this.props.enterEdge(ev.currentTarget.id); } handleMouseLeave(ev) { this.props.leaveEdge(ev.currentTarget.id); } } function mapStateToProps(state) { return { contrastMode: state.get('contrastMode') }; } export default connect( mapStateToProps, { enterEdge, leaveEdge } )(Edge);