Files
freeCodeCamp/client/src/components/settings/Honesty.js

53 lines
1.2 KiB
JavaScript
Raw Normal View History

import React from 'react';
2018-09-21 14:49:13 +01:00
import PropTypes from 'prop-types';
import { Button, Panel } from '@freecodecamp/react-bootstrap';
import { FullWidthRow } from '../helpers';
2018-09-21 14:49:13 +01:00
import SectionHeader from './SectionHeader';
import HonestyPolicy from '../../resources/honesty-policy';
2018-09-21 14:49:13 +01:00
import './honesty.css';
const propTypes = {
isHonest: PropTypes.bool,
updateIsHonest: PropTypes.func.isRequired
};
const Honesty = ({ isHonest, updateIsHonest }) => {
const button = isHonest ? (
<Button
block={true}
bsStyle='primary'
className='disabled-agreed'
disabled={true}
>
2018-09-21 14:49:13 +01:00
<p>You have accepted our Academic Honesty Policy.</p>
</Button>
) : (
<Button
block={true}
bsStyle='primary'
onClick={() => updateIsHonest({ isHonest: true })}
>
Agree
</Button>
2018-09-21 14:49:13 +01:00
);
return (
<section className='honesty-policy'>
<SectionHeader>Academic Honesty Policy</SectionHeader>
<FullWidthRow>
<Panel className='honesty-panel'>
<HonestyPolicy />
</Panel>
<br />
{button}
</FullWidthRow>
</section>
);
};
2018-09-21 14:49:13 +01:00
Honesty.displayName = 'Honesty';
Honesty.propTypes = propTypes;
export default Honesty;