2017-05-03 02:04:16 +02:00
|
|
|
import React from 'react';
|
2017-04-21 20:05:35 +02:00
|
|
|
import PropTypes from 'prop-types';
|
2017-02-14 20:59:26 +01:00
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
|
|
import Toggle from 'react-toggle';
|
|
|
|
|
2017-06-23 19:36:54 +02:00
|
|
|
export default class StatusCheckBox extends React.PureComponent {
|
2017-02-14 20:59:26 +01:00
|
|
|
|
2017-05-12 14:44:10 +02:00
|
|
|
static propTypes = {
|
|
|
|
status: ImmutablePropTypes.map.isRequired,
|
|
|
|
checked: PropTypes.bool,
|
|
|
|
onToggle: PropTypes.func.isRequired,
|
2017-05-20 17:31:47 +02:00
|
|
|
disabled: PropTypes.bool,
|
2017-05-12 14:44:10 +02:00
|
|
|
};
|
|
|
|
|
2017-02-14 20:59:26 +01:00
|
|
|
render () {
|
|
|
|
const { status, checked, onToggle, disabled } = this.props;
|
2017-08-07 20:32:03 +02:00
|
|
|
const content = { __html: status.get('contentHtml') };
|
2017-02-14 20:59:26 +01:00
|
|
|
|
2017-02-14 23:59:46 +01:00
|
|
|
if (status.get('reblog')) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2017-02-14 20:59:26 +01:00
|
|
|
return (
|
2017-04-23 04:26:55 +02:00
|
|
|
<div className='status-check-box'>
|
2017-02-14 20:59:26 +01:00
|
|
|
<div
|
|
|
|
className='status__content'
|
|
|
|
dangerouslySetInnerHTML={content}
|
|
|
|
/>
|
|
|
|
|
2017-04-23 04:26:55 +02:00
|
|
|
<div className='status-check-box-toggle'>
|
2017-02-14 20:59:26 +01:00
|
|
|
<Toggle checked={checked} onChange={onToggle} disabled={disabled} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-04-21 20:05:35 +02:00
|
|
|
}
|