-
Notifications
You must be signed in to change notification settings - Fork 0
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
Create component for Ingredient Search Box #28
Changes from 2 commits
566fa40
671b001
37ea972
e3b08de
fa3ca08
0cb1568
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
$colors-purple: #44318D; | ||
$colors-light-purple: #8162FF; | ||
$colors-light-gray-0: #757575; | ||
$colors-light-gray-1: #999; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Incorrect line ending There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets follow this pattern for partials defined by scss and name the file |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,31 +3,23 @@ import PropTypes from 'prop-types'; | |
import './SearchBox.scss'; | ||
|
||
class SearchBox extends Component { | ||
constructor(props) { | ||
super(); | ||
state = { | ||
value: '', | ||
}; | ||
|
||
this.props = props; | ||
this.state = { | ||
value: '', | ||
}; | ||
onInputChange = ({ target: { value } }) => ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary parenthesis around this.setState, can all be condensed to one line. |
||
this.setState({ value }) | ||
); | ||
|
||
this.onInputChange = this.onInputChange.bind(this); | ||
} | ||
|
||
onInputChange(event) { | ||
const { value } = event.target; | ||
|
||
this.setState({ value }); | ||
} | ||
|
||
render() { | ||
render = () => { | ||
const { value } = this.state; | ||
const { placeholder } = this.props; | ||
|
||
return ( | ||
<div className="searchbox"> | ||
<div className="search-box"> | ||
<input | ||
onChange={this.onInputChange} | ||
placeholder={this.props.placeholder} | ||
placeholder={placeholder} | ||
value={value} | ||
spellCheck={false} | ||
/> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
.searchbox { | ||
@import '~styles/colors'; | ||
|
||
.search-box { | ||
$input-font-size: 30px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's better to use em's so we can handle responsive changes easily in the future There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, I think we should move our scss variables out into a separate file so that they can be imported anywhere and we can change them in one place if need be. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These variables are local to this file. The variables defined here are just intended for this file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the em's. There is a separate bug that will cover px -> em's. #29 |
||
$input-line-height: 70px; | ||
$font-family: Roboto Slab, sans-serif; | ||
|
@@ -15,24 +17,24 @@ | |
border-radius: 0; | ||
line-height: $input-line-height; | ||
background-color: transparent; | ||
color: #757575; | ||
color: $colors-light-gray-0; | ||
font-size: $input-font-size; | ||
border: none; | ||
outline: none; | ||
border-bottom: 3px solid #757575; | ||
border-bottom: 3px solid $colors-light-gray-0; | ||
font-family: $font-family; | ||
|
||
::placeholder { | ||
color: $colors-light-gray-1; | ||
} | ||
|
||
&:focus { | ||
+ .input-highlight { | ||
border-top: 3px solid #8162FF; | ||
border-top: 3px solid $colors-light-purple; | ||
} | ||
} | ||
} | ||
|
||
::placeholder { | ||
color: #999; | ||
} | ||
|
||
.input-highlight { | ||
font-size: $input-font-size; | ||
user-select: none; | ||
|
@@ -47,4 +49,4 @@ | |
font-family: $font-family; | ||
overflow: hidden; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,7 +70,7 @@ module.exports = { | |
alias: { | ||
components: path.resolve(__dirname, 'src/components'), | ||
state: path.resolve(__dirname, 'src/state'), | ||
styles: path.resolve(__dirname, 'src/components/styles'), | ||
styles: path.resolve(__dirname, 'src/assets/styles'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I realize we don't have a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd still rather keep them under There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh we should def keep it under assets but just rename it to something other than styles There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If its There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah good point, lets name it something else then There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because it's not holding styles! What makes it more confusing is that you also call the alias |
||
images: path.resolve(__dirname, 'src/assets/images'), | ||
}, | ||
extensions: ['.js', '.jsx'], | ||
|
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make class member functions es6 style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not needed... You can do it without it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sukritchhabra It is. ES6 Class functions are not in the rules of basic es-lint. Need a babel wrapper for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes, you're right! I uninstalled it locally not globally while checking...