forked from Kenshin/simpread
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactionbar.jsx
More file actions
56 lines (49 loc) · 1.6 KB
/
actionbar.jsx
File metadata and controls
56 lines (49 loc) · 1.6 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
54
55
56
console.log( "=== simpread action bar load ===" )
import * as ss from 'stylesheet';
import Button from 'button';
import * as ttips from 'tooltip';
/**
* Action bar
*
* @class
*/
export default class Actionbar extends React.Component {
static defaultProps = {
items: [],
}
static propTypes = {
items : React.PropTypes.array,
onAction: React.PropTypes.func,
}
constructor( props ) {
super( props );
}
render() {
const items = Object.keys(this.props.items).map( key => {
const action = this.props.items[key];
const items = Object.keys( this.props.items[key].items ).map( item => {
const obj = this.props.items[key].items[item];
return (
<Button shape="circle"
icon={ obj.icon }
color="#fff" backgroundColor={ obj.color }
waves="md-waves-effect md-waves-button"
tooltip={{ text: obj.name }}
onClick={ ()=>this.props.onAction && this.props.onAction( item ) }
/>
)
})
return (
<sr-opt-gp>
<sr-opt-label>{action.name}</sr-opt-label>
<actions style={{ display: "flex", margin: "10px 0" }}>{ items }</actions>
</sr-opt-gp>
);
});
return (
<action-bar>
{ items }
</action-bar>
)
}
}