Skip to content

Commit

Permalink
added a form, added a submit input, added completed state, and styled…
Browse files Browse the repository at this point in the history
… our generate-button and button-wrapper
  • Loading branch information
Maxnelson997 committed Mar 8, 2018
1 parent c93382c commit 4eb508f
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 9 deletions.
Binary file added .DS_Store
Binary file not shown.
28 changes: 20 additions & 8 deletions src/components/madlib_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class MadlibForm extends Component {
super(props)

this.state = {
completedForm: false,
color: '',
pluralNoun: '',
adjectiveOne: '',
Expand All @@ -41,7 +42,6 @@ class MadlibForm extends Component {
nounOne: '',
numberOne: '',
numberTwo: '',

}

}
Expand All @@ -54,6 +54,11 @@ class MadlibForm extends Component {
}.bind(this);
}

handleSubmit = function(event) {
this.setState({completedForm: true});
event.preventDefault();
}.bind(this);

render() {

this.inputData = [
Expand All @@ -72,13 +77,20 @@ class MadlibForm extends Component {
return (
<div className="card-wrapper">
<Card>
<Row style={{textAlign: 'center', color: 'white'}}>
{
_.map(this.inputData, (data, indexKey) => {
return <MadlibInput key={indexKey} index={indexKey + 1} state={data.state} placeholder={data.placeholder} onChange={this.handleChange({inputTitle: data.prop})} />
})
}
</Row>
<form onSubmit={this.handleSubmit} id="madlib-form">
<Row style={{textAlign: 'center', color: 'white'}}>
{
_.map(this.inputData, (data, indexKey) => {
return <MadlibInput key={indexKey} index={indexKey + 1} state={data.state} placeholder={data.placeholder} onChange={this.handleChange({inputTitle: data.prop})} />
})
}
</Row>
<Row>
<Col md="12" className="button-wrapper">
<input type="submit" className="generate-button" value="Generate Mad Lib" />
</Col>
</Row>
</form>
</Card>
</div>

Expand Down
19 changes: 18 additions & 1 deletion src/style/components/madlib_form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,21 @@ input {
font-size: 18px;
text-align: center;
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;

}

4 changes: 4 additions & 0 deletions src/style/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@
@import 'components/madlib_form';
@import 'header';

body {
font-family: $font-primary;
}


0 comments on commit 4eb508f

Please sign in to comment.