-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWidget.js
More file actions
53 lines (45 loc) · 1.23 KB
/
Widget.js
File metadata and controls
53 lines (45 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import React, { Component, PropTypes } from 'react';
import { Tile } from 'decorators';
import defaultProps from './defaultProps';
import styles from './styles';
@Tile
export default class Widget extends Component {
static propTypes = {
/* Card Common props */
data: PropTypes.string,
fontSize: PropTypes.string,
color: PropTypes.string,
prefix: PropTypes.string,
postfix: PropTypes.string,
background: PropTypes.string,
};
static defaultProps = defaultProps;
_getWidgetStyle() {
const { background, color, fontSize } = this.props;
const divStyle = {
width: '100%',
height: '100%',
background,
color,
fontSize,
textAlign: 'center',
};
return divStyle;
}
render() {
const { data, prefix, postfix } = this.props;
return (
<div
style={this._getWidgetStyle()}
className="layout vertical center-center fullWidth fullHeight"
>
<div className="layout horizontal flex-3 center-center fullWidth">
Hello World !
</div>
<div className="layout horizontal flex-1 center-center fullWidth topLine">
<span style={styles.data}>{prefix} {data} {postfix}</span>
</div>
</div>
);
}
}