From b06d26a3dc12185d94f6bf53844abe5c57a719b1 Mon Sep 17 00:00:00 2001 From: BryMon Date: Fri, 19 Oct 2018 11:00:54 +0100 Subject: [PATCH 01/11] use destructuring, relates #158 --- src/components/Pages/Revision/RevisionPage.js | 14 +++----------- src/components/TopBar/TopBar.js | 4 +--- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/components/Pages/Revision/RevisionPage.js b/src/components/Pages/Revision/RevisionPage.js index de1d0c2..1170e05 100644 --- a/src/components/Pages/Revision/RevisionPage.js +++ b/src/components/Pages/Revision/RevisionPage.js @@ -75,21 +75,15 @@ export default class RevisionPage extends React.Component { id="revision" markComplete={this.markComplete} swipe={this.swipe} - caseTitle={this.state.caseTitle} - caseDetails={this.state.caseDetails} - caseDetailsDisplayed={this.state.caseDetailsDisplayed} - markSchemeElements={this.state.markSchemeElements} - markSchemeCompleted={this.state.markSchemeCompleted} + {...this.state} /> ); const resultsContainer = ( ); const { exam, station } = this.props.match.params; @@ -98,11 +92,9 @@ export default class RevisionPage extends React.Component { {this.state.resultsDisplayed ? resultsContainer : revisionContainer} diff --git a/src/components/TopBar/TopBar.js b/src/components/TopBar/TopBar.js index 7437dd7..0e225fd 100644 --- a/src/components/TopBar/TopBar.js +++ b/src/components/TopBar/TopBar.js @@ -51,11 +51,9 @@ export default class TopBar extends React.Component { )} {this.props.tickDisplayed && ( )} From 68f74d5ffd8303e0c2f1a159d87c68defda2f74d Mon Sep 17 00:00:00 2001 From: BryMon Date: Fri, 19 Oct 2018 11:11:42 +0100 Subject: [PATCH 02/11] make title a functional component, relates #154 --- src/components/Cases/Title.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/Cases/Title.js b/src/components/Cases/Title.js index 97cabf4..53ca44b 100644 --- a/src/components/Cases/Title.js +++ b/src/components/Cases/Title.js @@ -3,11 +3,9 @@ import React from "react"; import PropTypes from "prop-types"; -export default class CasesPageTitle extends React.Component { - render() { - return

{this.props.stationName}

; - } -} +const CasesPageTitle = props =>

{props.stationName}

; + +export default CasesPageTitle; CasesPageTitle.propTypes = { stationName: PropTypes.string From bc357716d111d704d482cd9d941c7e4684d3e27e Mon Sep 17 00:00:00 2001 From: BryMon Date: Fri, 19 Oct 2018 11:15:56 +0100 Subject: [PATCH 03/11] make addnewbanner a functional component, relates #154 --- src/components/Cases/Title.js | 4 ++-- src/components/Pages/AddNew/AddNewBanner.js | 16 +++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/components/Cases/Title.js b/src/components/Cases/Title.js index 53ca44b..157c101 100644 --- a/src/components/Cases/Title.js +++ b/src/components/Cases/Title.js @@ -5,8 +5,8 @@ import PropTypes from "prop-types"; const CasesPageTitle = props =>

{props.stationName}

; -export default CasesPageTitle; - CasesPageTitle.propTypes = { stationName: PropTypes.string }; + +export default CasesPageTitle; diff --git a/src/components/Pages/AddNew/AddNewBanner.js b/src/components/Pages/AddNew/AddNewBanner.js index 0d0e8a2..cd84041 100644 --- a/src/components/Pages/AddNew/AddNewBanner.js +++ b/src/components/Pages/AddNew/AddNewBanner.js @@ -17,18 +17,16 @@ const StyledCase = styled.div` border: none; `; -export default class AddNewBanner extends React.Component { - render() { - return ( - - Add New - - ); - } -} +const AddNewBanner = props => ( + + Add New + +); AddNewBanner.propTypes = { exam: PropTypes.string, station: PropTypes.string, submitStation: PropTypes.func }; + +export default AddNewBanner; From c0b425121b839f4e3311cd9af20cd39516ae76f0 Mon Sep 17 00:00:00 2001 From: BryMon Date: Fri, 19 Oct 2018 11:17:51 +0100 Subject: [PATCH 04/11] make AddNewTile a functional component, relates #154 --- src/components/Pages/AddNew/AddNewTile.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/components/Pages/AddNew/AddNewTile.js b/src/components/Pages/AddNew/AddNewTile.js index a259a11..2b532be 100644 --- a/src/components/Pages/AddNew/AddNewTile.js +++ b/src/components/Pages/AddNew/AddNewTile.js @@ -3,12 +3,10 @@ import React from "react"; import { Link } from "react-router-dom"; -export default class AddNewTile extends React.Component { - render() { - return ( - -
Add New
- - ); - } -} +const AddNewTile = () => ( + +
Add New
+ +); + +export default AddNewTile; From b1fffa94ab2433b9f6b46aab8cc39c53e9c4d959 Mon Sep 17 00:00:00 2001 From: BryMon Date: Fri, 19 Oct 2018 11:19:34 +0100 Subject: [PATCH 05/11] make InstructionText a functional component, relates #154 --- src/components/Pages/AddNew/InstructionText.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/components/Pages/AddNew/InstructionText.js b/src/components/Pages/AddNew/InstructionText.js index 82b1caa..b5ef3af 100644 --- a/src/components/Pages/AddNew/InstructionText.js +++ b/src/components/Pages/AddNew/InstructionText.js @@ -8,16 +8,12 @@ const StyledInstructionH2 = styled.h2` margin: 0 16px 16px 16px; `; -export default class InstructionText extends React.Component { - render() { - return ( - - {this.props.text} - - ); - } -} +const InstructionText = props => ( + {props.text} +); InstructionText.propTypes = { text: PropTypes.string }; + +export default InstructionText; From 66106b258194675765e41a3b8cd414a628908684 Mon Sep 17 00:00:00 2001 From: BryMon Date: Fri, 19 Oct 2018 11:21:53 +0100 Subject: [PATCH 06/11] make NewTileInput a functional component --- src/components/Pages/AddNew/NewTileInput.js | 22 ++++++++++----------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/components/Pages/AddNew/NewTileInput.js b/src/components/Pages/AddNew/NewTileInput.js index 501c36b..9dcc7e5 100644 --- a/src/components/Pages/AddNew/NewTileInput.js +++ b/src/components/Pages/AddNew/NewTileInput.js @@ -10,20 +10,18 @@ const StyledNewTileInputContainer = styled.div` margin-top: 100px; `; -export default class NewTileInput extends React.Component { - render() { - return ( - - - - - - - ); - } -} +const NewTileInput = props => ( + + + + + + +); NewTileInput.propTypes = { instructionText: PropTypes.string, userTypes: PropTypes.func }; + +export default NewTileInput; From d122318f4edde363f20a03986e268c413e03cee0 Mon Sep 17 00:00:00 2001 From: BryMon Date: Fri, 19 Oct 2018 11:23:35 +0100 Subject: [PATCH 07/11] make RevisionTitle funct comp --- src/components/Pages/Revision/RevisionTitle.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/Pages/Revision/RevisionTitle.js b/src/components/Pages/Revision/RevisionTitle.js index a144cef..f2df26a 100644 --- a/src/components/Pages/Revision/RevisionTitle.js +++ b/src/components/Pages/Revision/RevisionTitle.js @@ -3,12 +3,12 @@ import React from "react"; import PropTypes from "prop-types"; -export default class RevisionTitle extends React.Component { - render() { - return

{this.props.caseTitle}

; - } -} +const RevisionTitle = props => ( +

{this.props.caseTitle}

+); RevisionTitle.propTypes = { caseTitle: PropTypes.string }; + +export default RevisionTitle; From 20dae04bac083da8db0f6a369d47f3910d5cdcce Mon Sep 17 00:00:00 2001 From: BryMon Date: Fri, 19 Oct 2018 11:25:17 +0100 Subject: [PATCH 08/11] make ComingSoon funct comp --- src/components/Pages/ComingSoon.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/components/Pages/ComingSoon.js b/src/components/Pages/ComingSoon.js index 79f062f..80122ac 100644 --- a/src/components/Pages/ComingSoon.js +++ b/src/components/Pages/ComingSoon.js @@ -19,15 +19,13 @@ const ComingSoonImg = styled.img` max-height: 100%; `; -export default class ComingSoon extends React.Component { - render() { - return ( - - - - - - - ); - } -} +const ComingSoon = () => ( + + + + + + +); + +export default ComingSoon; From 09ed905b2533fcbfb70bc331801ee6c692810de9 Mon Sep 17 00:00:00 2001 From: BryMon Date: Fri, 19 Oct 2018 11:26:38 +0100 Subject: [PATCH 09/11] make StatisticsPage funct comp --- src/components/Pages/Statistics.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/components/Pages/Statistics.js b/src/components/Pages/Statistics.js index 89dd5b3..bd11215 100644 --- a/src/components/Pages/Statistics.js +++ b/src/components/Pages/Statistics.js @@ -1,14 +1,11 @@ /* eslint-disable class-methods-use-this */ import React from "react"; -import Navbar from "../Navbar/Navbar"; import ComingSoon from "../Pages/ComingSoon"; -export default class StatisticsPage extends React.Component { - render() { - return ( -
- -
- ); - } -} +const StatisticsPage = () => ( +
+ +
+); + +export default StatisticsPage; From e3a24c99e4ea8e0cad04cf02b987d0e3f0284454 Mon Sep 17 00:00:00 2001 From: BryMon Date: Fri, 19 Oct 2018 11:28:32 +0100 Subject: [PATCH 10/11] make BackButton a funct comp --- src/components/TopBar/BackButton.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/components/TopBar/BackButton.js b/src/components/TopBar/BackButton.js index 3830608..0911ee6 100644 --- a/src/components/TopBar/BackButton.js +++ b/src/components/TopBar/BackButton.js @@ -17,17 +17,13 @@ const StyledImg = styled.img` height: 20px; `; -export default class BackButton extends React.Component { - render() { - return ( - - - - - - ); - } -} +const BackButton = ({ link }) => ( + + + + + +); BackButton.propTypes = { link: PropTypes.string @@ -36,3 +32,5 @@ BackButton.propTypes = { BackButton.contextTypes = { router: PropTypes.object }; + +export default BackButton; From efd5e0a0e57fc9491e7b2b3f8c41806f09e1b0fb Mon Sep 17 00:00:00 2001 From: BryMon Date: Fri, 19 Oct 2018 11:33:58 +0100 Subject: [PATCH 11/11] fix props for revisionTitle --- src/components/Pages/Revision/RevisionTitle.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/Pages/Revision/RevisionTitle.js b/src/components/Pages/Revision/RevisionTitle.js index f2df26a..8266958 100644 --- a/src/components/Pages/Revision/RevisionTitle.js +++ b/src/components/Pages/Revision/RevisionTitle.js @@ -3,9 +3,7 @@ import React from "react"; import PropTypes from "prop-types"; -const RevisionTitle = props => ( -

{this.props.caseTitle}

-); +const RevisionTitle = props =>

{props.caseTitle}

; RevisionTitle.propTypes = { caseTitle: PropTypes.string