2018-09-21 14:49:13 +01:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { Button, Panel } from '@freecodecamp/react-bootstrap';
|
|
|
|
|
2019-02-22 18:58:38 +05:30
|
|
|
import { FullWidthRow } from '../helpers';
|
2018-09-21 14:49:13 +01:00
|
|
|
import SectionHeader from './SectionHeader';
|
2019-02-22 18:58:38 +05:30
|
|
|
import HonestyPolicy from '../../resources/honesty-policy';
|
2018-09-21 14:49:13 +01:00
|
|
|
|
|
|
|
import './honesty.css';
|
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
isHonest: PropTypes.bool,
|
|
|
|
policy: PropTypes.arrayOf(PropTypes.string),
|
|
|
|
updateIsHonest: PropTypes.func.isRequired
|
|
|
|
};
|
|
|
|
|
|
|
|
class Honesty extends Component {
|
|
|
|
handleAgreeClick = () => this.props.updateIsHonest({ isHonest: true });
|
|
|
|
|
|
|
|
renderAgreeButton = () => (
|
|
|
|
<Button block={true} bsStyle='primary' onClick={this.handleAgreeClick}>
|
|
|
|
Agree
|
|
|
|
</Button>
|
|
|
|
);
|
|
|
|
|
|
|
|
renderIsHonestAgreed = () => (
|
|
|
|
<Panel bsStyle='info' className='agreed btn'>
|
|
|
|
<p>You have accepted our Academic Honesty Policy.</p>
|
|
|
|
</Panel>
|
|
|
|
);
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { isHonest } = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<section className='honesty-policy'>
|
|
|
|
<SectionHeader>Academic Honesty Policy</SectionHeader>
|
|
|
|
<FullWidthRow>
|
|
|
|
<Panel className='honesty-panel'>
|
2019-02-22 18:58:38 +05:30
|
|
|
<HonestyPolicy />
|
2018-09-21 14:49:13 +01:00
|
|
|
</Panel>
|
2019-02-22 18:58:38 +05:30
|
|
|
<br />
|
|
|
|
{isHonest ? this.renderIsHonestAgreed() : this.renderAgreeButton()}
|
2018-09-21 14:49:13 +01:00
|
|
|
</FullWidthRow>
|
|
|
|
</section>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Honesty.displayName = 'Honesty';
|
|
|
|
Honesty.propTypes = propTypes;
|
|
|
|
|
|
|
|
export default Honesty;
|