1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 09:35:10 +01:00
onion/js/components/ascribe_forms/input_checkbox.js
2015-07-10 18:51:35 +02:00

46 lines
1.3 KiB
JavaScript

'use strict';
import React from 'react';
import { getLangText } from '../../utils/lang_utils';
let InputCheckbox = React.createClass({
propTypes: {
required: React.PropTypes.string.isRequired,
label: React.PropTypes.string.isRequired
},
getInitialState() {
return {
show: false
};
},
handleFocus() {
this.refs.checkbox.getDOMNode().checked = !this.refs.checkbox.getDOMNode().checked;
this.setState({
show: this.refs.checkbox.getDOMNode().checked,
value: this.refs.checkbox.getDOMNode().checked
});
},
render() {
return (
<span
onClick={this.handleFocus}
onFocus={this.handleFocus}>
<input type="checkbox" ref="checkbox"/>
<span className="checkbox">
<span>
{' ' + getLangText('I agree to the Terms of Service') + ' '}
(<a href="/terms" target="_blank" style={{fontSize: '0.9em', color: 'rgba(0,0,0,0.7)'}}>
{getLangText('read')}
</a>)
</span>
</span>
</span>
);
}
});
export default InputCheckbox;