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

Marketplace: Add search header #62080

Merged
merged 8 commits into from
Mar 24, 2022
Merged

Conversation

Rolilink
Copy link
Contributor

@Rolilink Rolilink commented Mar 19, 2022

Changes proposed in this Pull Request

  • Adds a header to the marketplace.
  • Moves the search component from the navigation bar to the header.
  • Adds a list of recommended searches.

Screenshots

Mobile Tablet Desktop
Screen Shot 2022-03-23 at 4 20 29 PM Screen Shot 2022-03-23 at 4 20 09 PM Screen Shot 2022-03-23 at 4 19 30 PM

Testing instructions

  • Navigate into http://calypso.localhost:3000/plugins.
  • It should render the heading, the search bar and recommended searches.
  • Write seo on the search bar it should show seo related plugins.
  • Click the portfolio recommended search, it should show portfolio related plugins.
  • Navigate into http://calypso.localhost:3000/plugins/:siteSlug.
  • It should render the heading, the search bar and recommended searches.
  • Write seo on the search bar it should show seo related plugins.
  • Click the portfolio recommended search, it should show portfolio related plugins.

Related to #61863

@matticbot
Copy link
Contributor

matticbot commented Mar 19, 2022

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~217 bytes added 📈 [gzipped])

name     parsed_size           gzip_size
plugins       +917 B  (+0.1%)     +217 B  (+0.1%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

Comment on lines 367 to 407
const SearchHeader = ( props ) => {
const { doSearch, search, siteSlug, title, searchBoxRef } = props;

return (
<div className="plugins-browser__searchbox-container">
<div className="plugins-browser__searchbox-header">{ title }</div>
<div className="plugins-browser__searchbox" ref={ searchBoxRef }>
<SearchBox doSearch={ doSearch } search={ search } />
</div>
<PopularSearches
siteSlug={ siteSlug }
searchTerms={ [ 'shipping', 'seo', 'portfolio', 'chat', 'mailchimp' ] }
/>
</div>
);
};

const PopularSearches = ( props ) => {
const { searchTerms, siteSlug } = props;
const translate = useTranslate();

return (
<div className="plugins-browser__recommended-searches">
<div className="plugins-browser__recommended-searches-title">
{ translate( 'Most popular searches' ) }
</div>

<div className="plugins-browser__recommended-searches-list">
{ searchTerms.map( ( searchTerm ) => (
<a
href={ `/plugins/${ siteSlug || '' }?s=${ searchTerm }` }
className="plugins-browser__recommended-searches-list-item"
>
{ searchTerm }
</a>
) ) }
</div>
</div>
);
};

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move new components under plugins for the SearchHeader? This file has already become too big and hard to handle.

Copy link
Contributor

Choose a reason for hiding this comment

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

Bundling their respective CSS and removing it from client/my-sites/plugins/plugins-browser/style.scss too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, was thinking on doing that before pushing the PR to review

Comment on lines 80 to 81
<ActionsContainer ref={ actionsRef }>{ actions }</ActionsContainer>
{ children }
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the rationale behind this change? This component was created to have two sections:

  • left - Breadcrumb
  • right - ActionsContainer (as arbitrary children)

Do we really need a third section? Does unwrapping the children create any regressions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cpapazoglou I did this to be able to accommodate the sticky behavior of the SearchBox component, right now the FixedNavigationHeader behavior is to render the breadcrumbs and conditionally rendering the action section which is the one where the children's are rendered an example of this behavior can be seen on the woocommerce-installation flow.

To be able to stick the search bar without removing the actions at the right I added this changes, but I wonder if there is a better approach which doesn't impact the FixedNavigationHeader.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also I tested the flow where we use the FixedNavigationHeader and no regressions or weird behavior where caused.

@Rolilink Rolilink mentioned this pull request Mar 22, 2022
3 tasks
@obenland obenland linked an issue Mar 22, 2022 that may be closed by this pull request
3 tasks
@Rolilink Rolilink force-pushed the add/search-header-to-marketplace branch from 8b17774 to 4cbbeaa Compare March 23, 2022 20:52
@Rolilink Rolilink force-pushed the add/search-header-to-marketplace branch from f8af9a9 to 0325a0b Compare March 23, 2022 21:19
@Rolilink Rolilink marked this pull request as ready for review March 23, 2022 21:24
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Mar 23, 2022
@Rolilink Rolilink requested review from a team and vinimotaa March 23, 2022 21:41
Copy link
Contributor

@lsl lsl left a comment

Choose a reason for hiding this comment

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

LGTM

</div>
);
};

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for breaking things down like this. Everything being simple top level components is a nice way to make things re-usable in future.

Copy link
Contributor

@cpapazoglou cpapazoglou left a comment

Choose a reason for hiding this comment

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

Thanks for addressing all feedback and also splitting this which makes it far easier to review and merge! LGTM!

@Rolilink Rolilink merged commit 65cda31 into trunk Mar 24, 2022
@Rolilink Rolilink deleted the add/search-header-to-marketplace branch March 24, 2022 15:57
@a8ci18n
Copy link

a8ci18n commented Mar 24, 2022

This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/7205638

Thank you @Rolilink for including a screenshot in the description! This is really helpful for our translators.

@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Mar 24, 2022
@a8ci18n
Copy link

a8ci18n commented Apr 15, 2022

Translation for this Pull Request has now been finished.

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.

Marketplace: Add search header
5 participants