Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mon #161

Merged
merged 12 commits into from
Oct 19, 2018
8 changes: 3 additions & 5 deletions src/components/Cases/Title.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
import React from "react";
import PropTypes from "prop-types";

export default class CasesPageTitle extends React.Component {
render() {
return <h1 id="title">{this.props.stationName}</h1>;
}
}
const CasesPageTitle = props => <h1 id="title">{props.stationName}</h1>;

CasesPageTitle.propTypes = {
stationName: PropTypes.string
};

export default CasesPageTitle;
16 changes: 7 additions & 9 deletions src/components/Pages/AddNew/AddNewBanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,16 @@ const StyledCase = styled.div`
border: none;
`;

export default class AddNewBanner extends React.Component {
render() {
return (
<Link to={`/${this.props.exam}/${this.props.station}/add-case`}>
<StyledCase onClick={this.props.submitStation}> Add New</StyledCase>
</Link>
);
}
}
const AddNewBanner = props => (
<Link to={`/${props.exam}/${props.station}/add-case`}>
<StyledCase onClick={props.submitStation}> Add New</StyledCase>
</Link>
);

AddNewBanner.propTypes = {
exam: PropTypes.string,
station: PropTypes.string,
submitStation: PropTypes.func
};

export default AddNewBanner;
16 changes: 7 additions & 9 deletions src/components/Pages/AddNew/AddNewTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
import React from "react";
import { Link } from "react-router-dom";

export default class AddNewTile extends React.Component {
render() {
return (
<Link to="/history/add/station" id="add-station">
<div className="tile">Add New</div>
</Link>
);
}
}
const AddNewTile = () => (
<Link to="/history/add/station" id="add-station">
<div className="tile">Add New</div>
</Link>
);

export default AddNewTile;
14 changes: 5 additions & 9 deletions src/components/Pages/AddNew/InstructionText.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,12 @@ const StyledInstructionH2 = styled.h2`
margin: 0 16px 16px 16px;
`;

export default class InstructionText extends React.Component {
render() {
return (
<StyledInstructionH2 id="revision-title">
{this.props.text}
</StyledInstructionH2>
);
}
}
const InstructionText = props => (
<StyledInstructionH2 id="revision-title">{props.text}</StyledInstructionH2>
);

InstructionText.propTypes = {
text: PropTypes.string
};

export default InstructionText;
22 changes: 10 additions & 12 deletions src/components/Pages/AddNew/NewTileInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,18 @@ const StyledNewTileInputContainer = styled.div`
margin-top: 100px;
`;

export default class NewTileInput extends React.Component {
render() {
return (
<React.Fragment>
<StyledNewTileInputContainer>
<InstructionText text={this.props.instructionText} />
<NewTileTextInput userTypes={this.props.userTypes} />
</StyledNewTileInputContainer>
</React.Fragment>
);
}
}
const NewTileInput = props => (
<React.Fragment>
<StyledNewTileInputContainer>
<InstructionText text={props.instructionText} />
<NewTileTextInput userTypes={props.userTypes} />
</StyledNewTileInputContainer>
</React.Fragment>
);

NewTileInput.propTypes = {
instructionText: PropTypes.string,
userTypes: PropTypes.func
};

export default NewTileInput;
22 changes: 10 additions & 12 deletions src/components/Pages/ComingSoon.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ const ComingSoonImg = styled.img`
max-height: 100%;
`;

export default class ComingSoon extends React.Component {
render() {
return (
<React.Fragment>
<ComingSoonDiv>
<ComingSoonImg id="coming-soon-icon" src={comingSoonIcon} />
</ComingSoonDiv>
<NavBar />
</React.Fragment>
);
}
}
const ComingSoon = () => (
<React.Fragment>
<ComingSoonDiv>
<ComingSoonImg id="coming-soon-icon" src={comingSoonIcon} />
</ComingSoonDiv>
<NavBar />
</React.Fragment>
);

export default ComingSoon;
14 changes: 3 additions & 11 deletions src/components/Pages/Revision/RevisionPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
<ResultsContainer
markSchemeTotal={this.state.markSchemeElements.length}
markSchemeCompleted={this.state.markSchemeCompleted}
markSchemeElements={this.state.markSchemeElements}
caseTitle={this.state.caseTitle}
timeElapsed={this.state.time}
{...this.state}
/>
);
const { exam, station } = this.props.match.params;
Expand All @@ -98,11 +92,9 @@ export default class RevisionPage extends React.Component {
<TopBar
id="topbar"
backLink={`${exam}/${station}`}
stationName={this.state.stationName}
submitCase={this.submitCase}
tickDisplayed={this.state.tickDisplayed}
timer
time={this.state.time}
{...this.state}
/>
{this.state.resultsDisplayed ? resultsContainer : revisionContainer}
</React.Fragment>
Expand Down
8 changes: 3 additions & 5 deletions src/components/Pages/Revision/RevisionTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
import React from "react";
import PropTypes from "prop-types";

export default class RevisionTitle extends React.Component {
render() {
return <h2 id="revision-title">{this.props.caseTitle}</h2>;
}
}
const RevisionTitle = props => <h2 id="revision-title">{props.caseTitle}</h2>;

RevisionTitle.propTypes = {
caseTitle: PropTypes.string
};

export default RevisionTitle;
17 changes: 7 additions & 10 deletions src/components/Pages/Statistics.js
Original file line number Diff line number Diff line change
@@ -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 (
<div>
<ComingSoon />
</div>
);
}
}
const StatisticsPage = () => (
<div>
<ComingSoon />
</div>
);

export default StatisticsPage;
20 changes: 9 additions & 11 deletions src/components/TopBar/BackButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,13 @@ const StyledImg = styled.img`
height: 20px;
`;

export default class BackButton extends React.Component {
render() {
return (
<Link to={`/${this.props.link}`}>
<StyledButton>
<StyledImg src={xIcon} />
</StyledButton>
</Link>
);
}
}
const BackButton = ({ link }) => (
<Link to={`/${link}`}>
<StyledButton>
<StyledImg src={xIcon} />
</StyledButton>
</Link>
);

BackButton.propTypes = {
link: PropTypes.string
Expand All @@ -36,3 +32,5 @@ BackButton.propTypes = {
BackButton.contextTypes = {
router: PropTypes.object
};

export default BackButton;
4 changes: 1 addition & 3 deletions src/components/TopBar/TopBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,9 @@ export default class TopBar extends React.Component {
)}
{this.props.tickDisplayed && (
<CompleteButton
addNewFlow={this.props.addNewFlow}
exam={this.props.backLink}
station={this.props.station}
onClick={this.props.submitCase}
tickDisplayed={this.props.tickDisplayed}
{...this.props}
/>
)}
</TopBarContainer>
Expand Down