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

46 lines
1.3 KiB
JavaScript
Raw Normal View History

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