Skip to content

Commit

Permalink
implemented clear madlib button and gave it functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxnelson997 committed Mar 9, 2018
1 parent 4eb508f commit 42a0aed
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 13 deletions.
2 changes: 0 additions & 2 deletions src/components/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ export default class App extends Component {
</div>
</div>
<MadlibForm />


</div>
</div>
);
Expand Down
24 changes: 22 additions & 2 deletions src/components/madlib_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,27 @@ class MadlibForm extends Component {
event.preventDefault();
}.bind(this);

handleClick = function() {
this.setState({
completedForm: false,
color: '',
pluralNoun: '',
adjectiveOne: '',
celebrityOne: '',
adjectiveTwo: '',
nounOne: '',
numberOne: '',
numberTwo: '',
});
}.bind(this)

renderButton = function() {
if(this.state.completedForm) {
return <a className="clear-button" onClick={this.handleClick}>Clear Mad Lib</a>
}
return <input type="submit" className="generate-button" value="Generate Mad Lib" />
}

render() {

this.inputData = [
Expand All @@ -71,7 +92,6 @@ class MadlibForm extends Component {
{placeholder: 'Noun', prop: 'nounOne', state: this.state.nounOne},
{placeholder: 'Number', prop: 'numberOne', state: this.state.numberOne},
{placeholder: 'Number', prop: 'numberTwo', state: this.state.numberTwo},

]

return (
Expand All @@ -87,7 +107,7 @@ class MadlibForm extends Component {
</Row>
<Row>
<Col md="12" className="button-wrapper">
<input type="submit" className="generate-button" value="Generate Mad Lib" />
{this.renderButton()}
</Col>
</Row>
</form>
Expand Down
25 changes: 16 additions & 9 deletions src/style/components/madlib_form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,26 @@ input {
color: white;
}

.generate-button {
height: 50px;
width: 300px;
border-radius: 4px;
background-color: $bottegaGreen;
color: white;
font-size: 1.25em;
}

.button-wrapper {
display: flex;
flex-direction: column;
align-items: center;
}


.generate-button {
@include buttonStyles;
background-color: $bottegaGreen;
}

.clear-button, a {
@include buttonStyles;
background-color: $clearBlue;
padding-top: 9px;
text-align: center;
}

input:focus,
button:focus {
outline: none;
}
1 change: 1 addition & 0 deletions src/style/main.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

@import 'variables';
@import 'mixins';
@import 'components/madlib_form';
@import 'header';

Expand Down
9 changes: 9 additions & 0 deletions src/style/mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@mixin buttonStyles {
height: 50px;
width: 300px;
border-radius: 4px;
color: white !important;
font-size: 1.25em;
box-shadow: 0 2px 4px 0 rgba(0,0,0,0.1);
margin-top: 42px;
}

0 comments on commit 42a0aed

Please sign in to comment.