-
Notifications
You must be signed in to change notification settings - Fork 2k
Plugins redesign: Move browse all link to carousel #107175
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import { useI18n } from '@wordpress/react-i18n'; | ||
| import { recordTracksEvent } from 'calypso/lib/analytics/tracks'; | ||
| import { useSelector } from 'calypso/state'; | ||
| import { getSelectedSite } from 'calypso/state/ui/selectors'; | ||
|
|
||
| type BrowseAllActionProps = { | ||
| browseAllLink?: string; | ||
| className?: string; | ||
| listName?: string; | ||
| }; | ||
|
|
||
| const DEFAULT_ACTION_CLASS = 'plugins-results-header__action'; | ||
|
|
||
| export default function BrowseAllAction( { | ||
| browseAllLink, | ||
| className, | ||
| listName, | ||
| }: BrowseAllActionProps ) { | ||
| const { __ } = useI18n(); | ||
| const selectedSite = useSelector( getSelectedSite ); | ||
|
|
||
| if ( ! browseAllLink ) { | ||
| return null; | ||
| } | ||
|
|
||
| const handleBrowseAllClick = () => { | ||
| recordTracksEvent( 'calypso_plugin_browser_all_click', { | ||
| site: selectedSite?.domain, | ||
| list_name: listName, | ||
| blog_id: selectedSite?.ID, | ||
| } ); | ||
| }; | ||
|
|
||
| const actionClassName = className | ||
| ? `${ DEFAULT_ACTION_CLASS } ${ className }` | ||
| : DEFAULT_ACTION_CLASS; | ||
|
|
||
| return ( | ||
| <a className={ actionClassName } href={ browseAllLink } onClick={ handleBrowseAllClick }> | ||
| { __( 'Browse all' ) } | ||
| </a> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,9 +38,13 @@ | |
| justify-content: flex-end; | ||
| align-items: center; | ||
| flex-grow: 4; | ||
| text-decoration: underline; | ||
| svg { | ||
|
Comment on lines
38
to
42
|
||
| margin-left: 2px; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| .plugins-results-header__action { | ||
| text-decoration: none; | ||
| } | ||
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.
The new carousel integration with
controlsActionand conditional rendering ofbrowseAllActionlacks test coverage. The existing tests inplugins-browser-list/test/index.jsxdon't verify the carousel behavior withuseCarousel={true}or theBrowseAllActionplacement in carousel controls. Consider adding tests to verify: (1)BrowseAllActionis passed toDotPagerwhenuseCarouselis true, (2)browseAllLinkis undefined in header whenuseCarouselis true, and (3) the component renders correctly in carousel mode.