Skip to content
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

Merged
merged 10 commits into from Sep 6, 2019
Merged

De-dupe search bar components #30585

merged 10 commits into from Sep 6, 2019

Conversation

ajpal
Copy link
Contributor

@ajpal ajpal commented Sep 4, 2019

Sound Library:
Before:
image

After:
image

Icon Library:
Before:
image

After:
image

Animation Library:
Before:
image

After:
image

@ajpal ajpal requested a review from joshlory September 4, 2019 17:53
position: 'relative'
}
};

export default class AnimationPickerSearchBar extends React.Component {
static propTypes = {
value: PropTypes.string.isRequired,
placeholderText: PropTypes.string.isRequired,
styles: PropTypes.object.isRequired,
Copy link
Contributor

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:

Suggested change
styles: PropTypes.object.isRequired,
styles: PropTypes.object.shape({
searchArea: PropTypes.object,
icon: PropTypes.object,
input: PropTypes.object
});

What do you think?

Copy link
Contributor Author

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!

Copy link
Contributor

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>
@@ -31,32 +31,37 @@ const styles = {
top: 9,
left: 10
},
search: {
searchArea: {
position: 'relative'
}
};

export default class AnimationPickerSearchBar extends React.Component {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: SearchBar?

@codecov-io
Copy link

codecov-io commented Sep 5, 2019

Codecov Report

Merging #30585 into staging will decrease coverage by 1.16%.
The diff coverage is 80%.

Impacted file tree graph

@@             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
Flag Coverage Δ
#integration 55.75% <68.42%> (ø) ⬆️
#storybook 56.52% <73.52%> (-0.01%) ⬇️
#unit 58.09% <78.94%> (-0.03%) ⬇️
Impacted Files Coverage Δ
apps/src/code-studio/components/IconLibrary.jsx 82.14% <0%> (ø) ⬆️
.../src/p5lab/AnimationPicker/AnimationPickerBody.jsx 72.61% <100%> (+0.11%) ⬆️
apps/src/code-studio/components/SoundLibrary.jsx 81.81% <66.66%> (+1.42%) ⬆️
apps/src/templates/SearchBar.jsx 83.87% <77.27%> (ø)
apps/src/templates/SearchBar.story.jsx 90% <85.71%> (ø)
...emplates/manageStudents/ManageStudentsNameCell.jsx 85.41% <0%> (-4.17%) ⬇️
...lates/manageStudents/ManageStudentsActionsCell.jsx 63.29% <0%> (-2.54%) ⬇️
.../application_dashboard/admin_cohort_view_table.jsx 37.5% <0%> (-1.98%) ⬇️
...udio/pd/application_dashboard/quick_view_table.jsx 33.68% <0%> (-1.67%) ⬇️
...d/workshop_dashboard/components/workshop_table.jsx 32.43% <0%> (-1.49%) ⬇️
... and 709 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1906b92...deed22e. Read the comment docs.

1 similar comment
@codecov-io
Copy link

Codecov Report

Merging #30585 into staging will decrease coverage by 1.16%.
The diff coverage is 80%.

Impacted file tree graph

@@             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
Flag Coverage Δ
#integration 55.75% <68.42%> (ø) ⬆️
#storybook 56.52% <73.52%> (-0.01%) ⬇️
#unit 58.09% <78.94%> (-0.03%) ⬇️
Impacted Files Coverage Δ
apps/src/code-studio/components/IconLibrary.jsx 82.14% <0%> (ø) ⬆️
.../src/p5lab/AnimationPicker/AnimationPickerBody.jsx 72.61% <100%> (+0.11%) ⬆️
apps/src/code-studio/components/SoundLibrary.jsx 81.81% <66.66%> (+1.42%) ⬆️
apps/src/templates/SearchBar.jsx 83.87% <77.27%> (ø)
apps/src/templates/SearchBar.story.jsx 90% <85.71%> (ø)
...emplates/manageStudents/ManageStudentsNameCell.jsx 85.41% <0%> (-4.17%) ⬇️
...lates/manageStudents/ManageStudentsActionsCell.jsx 63.29% <0%> (-2.54%) ⬇️
.../application_dashboard/admin_cohort_view_table.jsx 37.5% <0%> (-1.98%) ⬇️
...udio/pd/application_dashboard/quick_view_table.jsx 33.68% <0%> (-1.67%) ⬇️
...d/workshop_dashboard/components/workshop_table.jsx 32.43% <0%> (-1.49%) ⬇️
... and 709 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1906b92...deed22e. Read the comment docs.

@codecov-io
Copy link

codecov-io commented Sep 5, 2019

Codecov Report

Merging #30585 into staging will decrease coverage by 1.16%.
The diff coverage is 80.95%.

Impacted file tree graph

@@             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
Flag Coverage Δ
#integration 55.75% <71.42%> (ø) ⬆️
#storybook 56.52% <76.47%> (-0.01%) ⬇️
#unit 58.09% <78.57%> (-0.03%) ⬇️
Impacted Files Coverage Δ
apps/src/code-studio/components/IconLibrary.jsx 82.14% <0%> (ø) ⬆️
apps/src/templates/SearchBar.jsx 86.2% <100%> (ø)
.../src/p5lab/AnimationPicker/AnimationPickerBody.jsx 72.61% <100%> (+0.11%) ⬆️
apps/src/code-studio/components/SoundLibrary.jsx 81.81% <66.66%> (+1.42%) ⬆️
apps/src/templates/SearchBar.story.jsx 90% <85.71%> (ø)
...emplates/manageStudents/ManageStudentsNameCell.jsx 85.41% <0%> (-4.17%) ⬇️
...lates/manageStudents/ManageStudentsActionsCell.jsx 63.29% <0%> (-2.54%) ⬇️
.../application_dashboard/admin_cohort_view_table.jsx 37.5% <0%> (-1.98%) ⬇️
...udio/pd/application_dashboard/quick_view_table.jsx 33.68% <0%> (-1.67%) ⬇️
...d/workshop_dashboard/components/workshop_table.jsx 32.43% <0%> (-1.49%) ⬇️
... and 710 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1906b92...44d6ee4. Read the comment docs.

render() {
let customStyles = this.props.styles || {};
return (
<div style={{...styles.searchArea, ...customStyles.searchArea}}>
Copy link
Contributor

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.

Copy link
Contributor

@joshlory joshlory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup!

@ajpal ajpal merged commit 733b12e into staging Sep 6, 2019
@ajpal ajpal deleted the sep3-search-component branch September 6, 2019 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants