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
De-dupe search bar components #30585
Conversation
apps/src/templates/SearchBar.jsx
Outdated
position: 'relative' | ||
} | ||
}; | ||
|
||
export default class AnimationPickerSearchBar extends React.Component { | ||
static propTypes = { | ||
value: PropTypes.string.isRequired, | ||
placeholderText: PropTypes.string.isRequired, | ||
styles: PropTypes.object.isRequired, |
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.
This feels a little weird but I can't 100% put my finger on why. Allowing the consumer to style different elements in the component makes sense, and so does combining all those properties into one object (I think). Maybe we should be explicit about what keys it takes:
styles: PropTypes.object.isRequired, | |
styles: PropTypes.object.shape({ | |
searchArea: PropTypes.object, | |
icon: PropTypes.object, | |
input: PropTypes.object | |
}); |
What do you think?
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.
oo, didn't know you could specify what keys the object has! Yeah that definitely feels better, thanks!
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.
Do all of these styles need to be customized? Or can we make smart defaults, and have them be the same everywhere <SearchBar/>
gets used?
Co-Authored-By: Josh Lory <josh.lory@code.org>
apps/src/templates/SearchBar.jsx
Outdated
@@ -31,32 +31,37 @@ const styles = { | |||
top: 9, | |||
left: 10 | |||
}, | |||
search: { | |||
searchArea: { | |||
position: 'relative' | |||
} | |||
}; | |||
|
|||
export default class AnimationPickerSearchBar extends React.Component { |
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.
Nit: SearchBar
?
…rg/code-dot-org into sep3-search-component
Codecov Report
@@ Coverage Diff @@
## staging #30585 +/- ##
===========================================
- Coverage 73.22% 72.05% -1.17%
===========================================
Files 2059 1379 -680
Lines 113161 85225 -27936
Branches 3499 3496 -3
===========================================
- Hits 82864 61412 -21452
+ Misses 27006 20546 -6460
+ Partials 3291 3267 -24
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## staging #30585 +/- ##
===========================================
- Coverage 73.22% 72.05% -1.17%
===========================================
Files 2059 1379 -680
Lines 113161 85225 -27936
Branches 3499 3496 -3
===========================================
- Hits 82864 61412 -21452
+ Misses 27006 20546 -6460
+ Partials 3291 3267 -24
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## staging #30585 +/- ##
===========================================
- Coverage 73.22% 72.05% -1.17%
===========================================
Files 2059 1379 -680
Lines 113161 85223 -27938
Branches 3499 3495 -4
===========================================
- Hits 82864 61410 -21454
+ Misses 27006 20547 -6459
+ Partials 3291 3266 -25
Continue to review full report at Codecov.
|
apps/src/templates/SearchBar.jsx
Outdated
render() { | ||
let customStyles = this.props.styles || {}; | ||
return ( | ||
<div style={{...styles.searchArea, ...customStyles.searchArea}}> |
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.
Are these style overrides still needed? It doesn't look like any consumer is passing these props in.
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.
Nice cleanup!
Sound Library:
Before:
After:
Icon Library:
Before:
After:
Animation Library:
Before:
After: