-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFormSubmit.js
More file actions
37 lines (31 loc) · 823 Bytes
/
FormSubmit.js
File metadata and controls
37 lines (31 loc) · 823 Bytes
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
'use strict'
import React from 'react'
import Button from './Button'
export default class FormSubmit extends React.Component {
static displayName = 'FormSubmit'
static propTypes = {
children: React.PropTypes.any,
locked: React.PropTypes.bool,
onClick: React.PropTypes.func,
style: React.PropTypes.object
}
render () {
let children = this.props.children
let content
if (Array.isArray(children)) {
content = this.props.locked ? children[1] : children[0]
} else {
content = children
}
return (
<div style={this.props.style} className="rct-control-group">
<Button type="submit"
status='primary'
onClick={this.props.onClick}
disabled={this.props.locked}>
{content}
</Button>
</div>
)
}
}