Skip to content

Commit

Permalink
Nav Redesign: Hide search and notifications on mobile (#90732)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmtr committed May 15, 2024
1 parent 83939ca commit 7d1c7e1
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions client/layout/global-sidebar/footer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { recordTracksEvent } from '@automattic/calypso-analytics';
import { useHasEnTranslation } from '@automattic/i18n-utils';
import { useBreakpoint } from '@automattic/viewport-react';
import { LocalizeProps } from 'i18n-calypso';
import { FC } from 'react';
import AsyncLoad from 'calypso/components/async-load';
Expand All @@ -20,6 +21,7 @@ export const GlobalSidebarFooter: FC< {
} > = ( { translate, user } ) => {
const hasEnTranslation = useHasEnTranslation();
const isInSupportSession = Boolean( useSelector( isSupportSession ) );
const isDesktop = useBreakpoint( '>=782px' );

const isMac = window?.navigator.userAgent && window.navigator.userAgent.indexOf( 'Mac' ) > -1;
const searchShortcut = isMac ? '⌘ + K' : 'Ctrl + K';
Expand All @@ -44,20 +46,24 @@ export const GlobalSidebarFooter: FC< {
}
onClick={ () => recordTracksEvent( GLOBAL_SIDEBAR_EVENTS.HELPCENTER_CLICK ) }
/>
<SidebarSearch
tooltip={
hasEnTranslation( 'Search (%(shortcut)s)' )
? translate( 'Search (%(shortcut)s)', { args: { shortcut: searchShortcut } } )
: translate( 'Jump to…' )
}
onClick={ () => recordTracksEvent( GLOBAL_SIDEBAR_EVENTS.SEARCH_CLICK ) }
/>
<SidebarNotifications
className="sidebar__item-notifications"
tooltip={ translate( 'Notifications' ) }
onClick={ () => recordTracksEvent( GLOBAL_SIDEBAR_EVENTS.NOTIFICATION_CLICK ) }
translate={ translate }
/>
{ isDesktop && (
<>
<SidebarSearch
tooltip={
hasEnTranslation( 'Search (%(shortcut)s)' )
? translate( 'Search (%(shortcut)s)', { args: { shortcut: searchShortcut } } )
: translate( 'Jump to…' )
}
onClick={ () => recordTracksEvent( GLOBAL_SIDEBAR_EVENTS.SEARCH_CLICK ) }
/>
<SidebarNotifications
className="sidebar__item-notifications"
tooltip={ translate( 'Notifications' ) }
onClick={ () => recordTracksEvent( GLOBAL_SIDEBAR_EVENTS.NOTIFICATION_CLICK ) }
translate={ translate }
/>
</>
) }
{ isInSupportSession && (
<QuickLanguageSwitcher className="sidebar__footer-language-switcher" shouldRenderAsButton />
) }
Expand Down

0 comments on commit 7d1c7e1

Please sign in to comment.