6ef41bf93c6f0b1c658a18f35f3b63265687c9c8
[osm/UI.git] / skyquake / plugins / composer / src / src / components / Button.js
1
2 /*
3 *
4 * Copyright 2016 RIFT.IO Inc
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 */
19 /**
20 * Created by onvelocity on 12/1/15.
21 */
22 'use strict';
23
24 import guid from '../libraries/guid'
25 import React from 'react'
26 import ClassNames from 'classnames'
27 import PureRenderMixin from 'react-addons-pure-render-mixin'
28 import SelectionManager from '../libraries/SelectionManager'
29
30 import '../styles/Button.scss'
31
32 const Button = React.createClass({
33 mixins: [PureRenderMixin],
34 getInitialState: function () {
35 return {};
36 },
37 getDefaultProps: function () {
38 return {
39 className: '',
40 label: null,
41 title: null,
42 src: null,
43 disabled: false,
44 onClick: () => {}
45 };
46 },
47 componentWillMount: function () {
48 },
49 componentDidMount: function () {
50 },
51 componentDidUpdate: function () {
52 },
53 componentWillUnmount: function () {
54 },
55 render() {
56 const src = this.props.src;
57 const label = this.props.label;
58 const title = this.props.title;
59 const draggable = this.props.draggable;
60 const className = ClassNames(this.props.className, 'Button');
61 return (
62 <div className={className} onClick={this.props.onClick} title={title} draggable={draggable} onDragStart={this.props.onDragStart} style={{pointerEvents: (this.props.disabled ? 'none' : 'auto'), cursor: (this.props.disabled ? 'not-allowed' : 'auto'), position: 'relative'}}>
63 { src ? <img src={src} /> : null }
64 {label}
65 </div>
66 );
67 }
68 });
69
70 export default Button;