diff --git a/client/src/components/settings/Honesty.js b/client/src/components/settings/Honesty.js index fdb126bafb..338c62b51b 100644 --- a/client/src/components/settings/Honesty.js +++ b/client/src/components/settings/Honesty.js @@ -1,4 +1,4 @@ -import React, { Component } from 'react'; +import React from 'react'; import PropTypes from 'prop-types'; import { Button, Panel } from '@freecodecamp/react-bootstrap'; @@ -10,20 +10,11 @@ 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 = () => ( - - ); - - renderIsHonestAgreed = () => ( +const Honesty = ({ isHonest, updateIsHonest }) => { + const button = isHonest ? ( + ) : ( + ); - - render() { - const { isHonest } = this.props; - - return ( -
- Academic Honesty Policy - - - - -
- {isHonest ? this.renderIsHonestAgreed() : this.renderAgreeButton()} -
-
- ); - } -} + return ( +
+ Academic Honesty Policy + + + + +
+ {button} +
+
+ ); +}; Honesty.displayName = 'Honesty'; Honesty.propTypes = propTypes;