Import W95 code from previously abandoned project

This commit is contained in:
2018-03-13 05:17:39 +11:00
parent b8cf5ebef2
commit 395713b4cd
16 changed files with 473 additions and 0 deletions

View File

@ -0,0 +1,45 @@
import React, { Component } from 'react';
import { render } from 'react-dom';
class ContextMenuButton extends Component {
constructor(props) {
super(props);
this.handleClick = function(e) {
e.stopPropagation();
if(this.isDisabled()) return;
this.props.button.props.menu.closeMenu();
this.clicked();
}.bind(this);
}
clicked() {
if(typeof this.props.data === 'function') {
this.props.data();
}
}
componentDidMount() {
this.refs.option.addEventListener('click', this.handleClick);
}
componentWillUmount() {
this.refs.option.removeEventListener('click', this.handleClick);
}
isDisabled() {return this.props.data === "disabled";}
render() {
let cls = "menu-option";
if(this.isDisabled()) cls += " disabled";
return (
<div className={cls} ref="option">
{this.props.title}
</div>
);
}
}
export default ContextMenuButton;