react-device-detect#isMacOs TypeScript Examples

The following examples show how to use react-device-detect#isMacOs. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainLayout.tsx    From amplication with Apache License 2.0 5 votes vote down vote up
Menu = ({ children }: MenuProps) => {
  const history = useHistory();
  const { trackEvent } = useTracking();

  const apolloClient = useApolloClient();

  const handleProfileClick = useCallback(() => {
    history.push("/user/profile");
  }, [history]);

  const handleSignOut = useCallback(() => {
    /**@todo: sign out on server */
    unsetToken();
    apolloClient.clearStore();

    history.replace("/");
  }, [history, apolloClient]);

  const handleSupportClick = useCallback(() => {
    trackEvent({
      eventName: "supportButtonClick",
    });
  }, [trackEvent]);

  return (
    <div className={classNames("main-layout__menu")}>
      <div className="main-layout__menu__wrapper">
        <div className="main-layout__menu__wrapper__main-menu">
          <div className="logo-container">
            <Link to="/" className="logo-container__logo">
              <Icon icon="logo" className="main-logo" />
              <LogoTextual />
            </Link>
          </div>

          <div className="menu-container">
            <CommandPalette
              trigger={
                <MenuItem
                  title="Search"
                  icon="search_outline"
                  overrideTooltip={`Search (${isMacOs ? "⌘" : "Ctrl"}+Shift+P)`}
                />
              }
            />
            {children}
          </div>
          <div className="bottom-menu-container">
            <DarkModeToggle />
            <Popover
              className="main-layout__menu__popover"
              content={<SupportMenu />}
              onOpen={handleSupportClick}
              placement="right"
            >
              <MenuItem
                icon="help_outline"
                hideTooltip
                title="Help and support"
              />
            </Popover>
            <MenuItem
              title="Profile"
              icon="plus"
              hideTooltip
              onClick={handleProfileClick}>
              <UserBadge />
            </MenuItem>
            <MenuItem
              title="Sign Out"
              icon="log_out_outline"
              onClick={handleSignOut}
            />
          </div>
        </div>
        <FixedMenuPanel.Target className="main-layout__menu__wrapper__menu-fixed-panel" />
      </div>
    </div>
  );
}