twenty/front/src/AppNavbar.tsx
Lucas Bordeau 21d5133564
Feat/improve mobile display (#843)
* Ok 1

* Finished

* Fix PR

* Fix PR

* Fix desktop

* Fix

* Fix absolute listen click outside

* console.log

* Fix according to code review

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2023-07-23 10:53:35 -07:00

74 lines
2.1 KiB
TypeScript

import { useLocation } from 'react-router-dom';
import { useTheme } from '@emotion/react';
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
import { SettingsNavbar } from '@/settings/components/SettingsNavbar';
import {
IconBuildingSkyscraper,
IconInbox,
IconSearch,
IconSettings,
IconTargetArrow,
IconUser,
} from '@/ui/icon/index';
import { useIsSubMenuNavbarDisplayed } from '@/ui/layout/hooks/useIsSubMenuNavbarDisplayed';
import MainNavbar from '@/ui/navbar/components/MainNavbar';
import NavItem from '@/ui/navbar/components/NavItem';
import NavTitle from '@/ui/navbar/components/NavTitle';
export function AppNavbar() {
const theme = useTheme();
const currentPath = useLocation().pathname;
const { openCommandMenu } = useCommandMenu();
const isInSubMenu = useIsSubMenuNavbarDisplayed();
return (
<>
{!isInSubMenu ? (
<MainNavbar>
<NavItem
label="Search"
icon={<IconSearch size={theme.icon.size.md} />}
onClick={() => {
openCommandMenu();
}}
/>
<NavItem
label="Inbox"
to="/inbox"
icon={<IconInbox size={theme.icon.size.md} />}
soon={true}
/>
<NavItem
label="Settings"
to="/settings/profile"
icon={<IconSettings size={theme.icon.size.md} />}
/>
<NavTitle label="Workspace" />
<NavItem
label="Companies"
to="/companies"
icon={<IconBuildingSkyscraper size={theme.icon.size.md} />}
active={currentPath === '/companies'}
/>
<NavItem
label="People"
to="/people"
icon={<IconUser size={theme.icon.size.md} />}
active={currentPath === '/people'}
/>
<NavItem
label="Opportunities"
to="/opportunities"
icon={<IconTargetArrow size={theme.icon.size.md} />}
active={currentPath === '/opportunities'}
/>
</MainNavbar>
) : (
<SettingsNavbar />
)}
</>
);
}