1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-30 00:00:13 +01:00
VILLASweb/src/components/widget-button.js
Ricardo Hernandez-Montoya 9d229a828c Button color selection
2017-04-24 14:41:23 +02:00

44 lines
No EOL
1.4 KiB
JavaScript

/**
* File: widget-button.js
* Author: Ricardo Hernandez-Montoya <rhernandez@gridhound.de>
* Date: 29.03.2017
* Copyright: 2017, Institute for Automation of Complex Power Systems, EONERC
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
* Unauthorized copying of this file, via any medium is strictly prohibited.
**********************************************************************************/
import React, { Component } from 'react';
import EditWidgetColorControl from './dialog/edit-widget-color-control';
class WidgetButton extends Component {
action(e) {
e.target.blur(); // Remove focus
console.log('Button widget action');
}
render() {
let colors = EditWidgetColorControl.ColorPalette;
let colorStyle = {
background: colors[this.props.widget.background_color],
color: colors[this.props.widget.font_color],
borderColor: colors[this.props.widget.font_color]
}
return (
<div className="button-widget full">
{ this.props.editing ? (
<button className="full btn btn-default" type="button" disabled onClick={ this.action } style={colorStyle}>{this.props.widget.name}</button>
) : (
<button className="full btn btn-default" type="button" onClick={ this.action } style={colorStyle}>{this.props.widget.name}</button>
)
}
</div>
);
}
}
export default WidgetButton;