mirror of
https://github.com/lingble/twenty.git
synced 2025-10-30 04:12:28 +00:00
66 lines
1.7 KiB
TypeScript
66 lines
1.7 KiB
TypeScript
import styled from '@emotion/styled';
|
|
import { useMatch, useResolvedPath } from 'react-router-dom';
|
|
import { User } from '../../interfaces/user.interface';
|
|
import { Workspace } from '../../interfaces/workspace.interface';
|
|
import NavItem from './NavItem';
|
|
import NavTitle from './NavTitle';
|
|
import WorkspaceContainer from './WorkspaceContainer';
|
|
import { faUser } from '@fortawesome/pro-regular-svg-icons';
|
|
import { faBuildings } from '@fortawesome/pro-regular-svg-icons';
|
|
|
|
const NavbarContainer = styled.div`
|
|
display: flex;
|
|
flex-direction: column;
|
|
background: ${(props) => props.theme.noisyBackground};
|
|
min-width: 220px;
|
|
padding: ${(props) => props.theme.spacing(2)};
|
|
`;
|
|
|
|
const NavItemsContainer = styled.div`
|
|
display: flex;
|
|
flex-direction: column;
|
|
margin-top: 40px;
|
|
`;
|
|
|
|
type OwnProps = {
|
|
user?: User;
|
|
workspace?: Workspace;
|
|
};
|
|
|
|
function Navbar({ workspace }: OwnProps) {
|
|
return (
|
|
<>
|
|
<NavbarContainer>
|
|
{workspace && <WorkspaceContainer workspace={workspace} />}
|
|
<NavItemsContainer>
|
|
<NavTitle label="Workspace" />
|
|
<NavItem
|
|
label="People"
|
|
to="/people"
|
|
icon={faUser}
|
|
active={
|
|
!!useMatch({
|
|
path: useResolvedPath('/people').pathname,
|
|
end: true,
|
|
})
|
|
}
|
|
/>
|
|
<NavItem
|
|
label="Companies"
|
|
to="/companies"
|
|
icon={faBuildings}
|
|
active={
|
|
!!useMatch({
|
|
path: useResolvedPath('/companies').pathname,
|
|
end: true,
|
|
})
|
|
}
|
|
/>
|
|
</NavItemsContainer>
|
|
</NavbarContainer>
|
|
</>
|
|
);
|
|
}
|
|
|
|
export default Navbar;
|