39 lines
847 B
JavaScript
39 lines
847 B
JavaScript
import React from "react"
|
|
import PropTypes from "prop-types"
|
|
import { Text, Icon } from "ui"
|
|
import { sizeInfo } from "ui/style"
|
|
|
|
export class BoundEmailIcon extends React.Component {
|
|
static propTypes = {
|
|
name: PropTypes.string,
|
|
binder: PropTypes.object,
|
|
}
|
|
|
|
constructor(props) {
|
|
super(props)
|
|
this.state = props.binder.getBindingState(props.name)
|
|
}
|
|
|
|
componentWillReceiveProps(nextProps) {
|
|
if (nextProps.binder !== this.props.binder) {
|
|
this.setState(nextProps.binder.getBindingState(nextProps.name))
|
|
}
|
|
}
|
|
|
|
render() {
|
|
const { value } = this.state
|
|
|
|
return (
|
|
<div>
|
|
<Text> </Text>
|
|
<br />
|
|
<Icon
|
|
name={value ? "confirmed" : "warning"}
|
|
size={sizeInfo.formBoundIcon}
|
|
margin={sizeInfo.formBoundIconMargin}
|
|
/>
|
|
</div>
|
|
)
|
|
}
|
|
}
|