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

Nav Redesign: Hide search and notifications on mobile #90732

Merged
merged 1 commit into from
May 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading