mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-05 11:11:13 +00:00
28 lines
715 B
JavaScript
28 lines
715 B
JavaScript
import React from 'react';
|
|
|
|
export default class TopologyOptionAction extends React.Component {
|
|
|
|
constructor(props, context) {
|
|
super(props, context);
|
|
this.onClick = this.onClick.bind(this);
|
|
}
|
|
|
|
onClick(ev) {
|
|
ev.preventDefault();
|
|
const { optionId, topologyId, item } = this.props;
|
|
this.props.onClick(optionId, item.get('value'), topologyId);
|
|
}
|
|
|
|
render() {
|
|
const { activeValue, item } = this.props;
|
|
const className = activeValue.includes(item.get('value'))
|
|
? 'topology-option-action topology-option-action-selected'
|
|
: 'topology-option-action';
|
|
return (
|
|
<div className={className} onClick={this.onClick}>
|
|
{item.get('label')}
|
|
</div>
|
|
);
|
|
}
|
|
}
|