Skip to content

Commit

Permalink
Add styling to Widget etc
Browse files Browse the repository at this point in the history
  • Loading branch information
Johnny Choudhury-Lucas committed Dec 23, 2017
1 parent d7094c4 commit 0d04222
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/components/AddOption.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export default class AddOption extends React.Component {
render () {
return (
<div>
{this.state.error && <div>{this.state.error}</div>}
<form onSubmit={this.handleAddOption}>
<input type='text' name='option' />
{this.state.error && <div className="add-option-error">{this.state.error}</div>}
<form className="add-option" onSubmit={this.handleAddOption}>
<input className="add-option__input" type='text' name='option' />
<button className="button">Add Option</button>
</form>

Expand Down
6 changes: 3 additions & 3 deletions src/components/Option.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import React from 'react'

const Option = (props) => {
return (
<p>
{props.optionText}
<div className="option">
<p className="option__text">{props.count}. {props.optionText}</p>
<button className="button button--link" onClick={(e) => {
// Rather than passing the whole event, just pass the option text
props.handleDeleteOption(props.optionText)
}}>remove</button>
</p>
</div>
)
} // End of Option stateless functional component definition

Expand Down
16 changes: 16 additions & 0 deletions src/components/OptionModal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react'
// Third Party Components
import Modal from 'react-modal'

const OptionModal = (props) => (
<Modal
isOpen={!!props.selectedOption}
contentLabel="Selected Option"

>
<h3>Selected Option</h3>
<p>{props.selectedOption}</p>
</Modal>
)

export default OptionModal
3 changes: 2 additions & 1 deletion src/components/Options.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ const Options = (props) => {
}
{
props.options.length > 0 &&
props.options.map((option) => {
props.options.map((option, index) => {
return (
<Option
key={option}
optionText={option}
count={index + 1}
handleDeleteOption={props.handleDeleteOption}
/>
)
Expand Down
20 changes: 20 additions & 0 deletions src/styles/components/_add-option.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.add-option {
display: flex;
padding: $m-size;
}
.add-option__input {
color: $off-white;
background: $dark-blue;
border: none;
border-bottom: .3rem solid darken($color: $dark-blue, $amount: 10);
flex-grow: 1;
margin-right: $s-size;
padding: $s-size;
}

.add-option-error {
color: $off-white;
font-style: italic;
padding: 0 $m-size;
margin-top: $m-size;
}
12 changes: 12 additions & 0 deletions src/styles/components/_option.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.option {
border-bottom: 1px solid lighten($color: $light-blue, $amount: 10);
display: flex;
justify-content: space-between;
padding: $l-size $m-size;
}

.option__text {
color: white;
font-weight: 500;
font-size: 2rem;
}
6 changes: 5 additions & 1 deletion src/styles/style.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Setup
@import './base/settings';
@import './base/base';
// Partials
@import './components/add-option';
@import './components/button';
@import './components/container';
@import './components/header';
@import './components/button';
@import './components/option';
@import './components/widget';

0 comments on commit 0d04222

Please sign in to comment.