Skip to content

Commit 9625f00

Browse files
authored
Merge pull request #1386 from prezly/feature/dev-22068-add-search-label-to-the-search-icon-in-the-nav
[DEV-22068] Feature - Show search text in button when there are less items in nav
2 parents a2745fe + d6c5dce commit 9625f00

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/modules/Header/ui/Header.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,13 @@ export function Header({
180180
const isCategoriesLayoutBar = categoriesLayout === 'bar';
181181
const isCategoriesLayoutDropdown = categoriesLayout === 'dropdown' || isMobile;
182182
const numberOfPublicGalleries = newsroom.public_galleries_number;
183+
const shouldShowSearchText =
184+
!isMobile &&
185+
[
186+
isPreview || numberOfPublicGalleries > 0,
187+
mainSiteUrl,
188+
isCategoriesLayoutDropdown && translatedCategories.length > 0,
189+
].filter(Boolean).length < 2;
183190

184191
return (
185192
<>
@@ -217,7 +224,11 @@ export function Header({
217224
aria-expanded={isSearchOpen}
218225
title={formatMessage(translations.search.title)}
219226
aria-label={formatMessage(translations.search.title)}
220-
/>
227+
>
228+
{shouldShowSearchText
229+
? formatMessage(translations.search.title)
230+
: undefined}
231+
</ButtonLink>
221232
)}
222233

223234
{shouldShowMenu && (

0 commit comments

Comments
 (0)