import { useI18n } from '@wordpress/react-i18n'; import clsx from 'clsx'; import { recordTracksEvent } from 'calypso/lib/analytics/tracks'; import { useSelector } from 'calypso/state'; import { getSelectedSite } from 'calypso/state/ui/selectors'; import type { TranslateResult } from 'i18n-calypso'; import './style.scss'; export default function PluginsResultsHeader( { className = '', title, subtitle, browseAllLink, resultCount, listName, isRootPage = true, }: { title: TranslateResult; subtitle: TranslateResult; browseAllLink?: string; resultCount?: string; className?: string; listName?: string; isRootPage?: boolean; } ) { const { __ } = useI18n(); const selectedSite = useSelector( getSelectedSite ); const TitleTag = isRootPage ? 'h2' : 'h1'; return (
{ ( title || subtitle ) && (
{ title && { title } } { subtitle &&

{ subtitle }

}
) } { ( browseAllLink || resultCount ) && (
{ browseAllLink && ( { recordTracksEvent( 'calypso_plugin_browser_all_click', { site: selectedSite?.domain, list_name: listName, blog_id: selectedSite?.ID, } ); } } > { __( 'Browse all' ) } ) } { resultCount && { resultCount } }
) }
); }