7a5a7f54f0b2e97ca0d9e04e7fd6c0b0ac81f6fe
[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 onClick: () => {}
44 };
45 },
46 componentWillMount: function () {
47 },
48 componentDidMount: function () {
49 },
50 componentDidUpdate: function () {
51 },
52 componentWillUnmount: function () {
53 },
54 render() {
55 const src = this.props.src;
56 const label = this.props.label;
57 const title = this.props.title;
58 const draggable = this.props.draggable;
59 const className = ClassNames(this.props.className, 'Button');
60 return (
61 <div className={className} onClick={this.props.onClick} title={title} draggable={draggable} onDragStart={this.props.onDragStart}>
62 <img src={src} />
63 <span>{label}</span>
64 </div>
65 );
66 }
67 });
68
69 export default Button;