Skip to content

Commit

Permalink
Merge pull request #153 from fac-14/tick-displayed
Browse files Browse the repository at this point in the history
Tick displayed
  • Loading branch information
sima-qian authored Oct 18, 2018
2 parents f419520 + 1f1b74f commit a7ff2b2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
6 changes: 0 additions & 6 deletions src/components/Pages/AddNew/AddBanner.js

This file was deleted.

35 changes: 21 additions & 14 deletions src/components/Pages/AddNew/AddTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,18 @@ const StyledAddNewBannerContainer = styled.div`
export default class AddTile extends React.Component {
state = {
exam: this.props.match.params.exam,
station: ""
station: "",
tickDisplayed: false
};

submitTile = () => {
airtableQuery(`/api/add-station/${removeWhitespace(this.state.station)}`);
};

userTypes = input => {
this.setState({ station: input });
input
? this.setState({ station: input, tickDisplayed: true })
: this.setState({ station: "", tickDisplayed: false });
};

render() {
Expand All @@ -42,21 +45,25 @@ export default class AddTile extends React.Component {
submitCase={this.submitTile}
stationName={"add new"}
station={this.state.station}
tickDisplayed={true}
tickDisplayed={this.state.tickDisplayed}
addNewFlow={true}
/>
<NewTileInput
instructionText={"Add station"}
userTypes={this.userTypes}
/>
<InstructionText text={"Add case"} />
<StyledAddNewBannerContainer>
<AddNewBanner
exam={this.state.exam}
station={this.state.station.replace(/\s/g, "-")}
submitStation={this.submitTile}
<StyledInstructionContainer>
<NewTileInput
instructionText={"Add station"}
userTypes={this.userTypes}
/>
</StyledAddNewBannerContainer>
</StyledInstructionContainer>
<InstructionText text={"Add case"} />
{this.state.station && (
<StyledAddNewBannerContainer>
<AddNewBanner
exam={this.state.exam}
station={this.state.station.replace(/\s/g, "-")}
submitStation={this.submitTile}
/>
</StyledAddNewBannerContainer>
)}
</React.Fragment>
);
}
Expand Down

0 comments on commit a7ff2b2

Please sign in to comment.