taskcafe/web/src/shared/components/TopNavbar/index.tsx

78 lines
1.9 KiB
TypeScript
Raw Normal View History

2020-04-10 04:40:22 +02:00
import React, { useRef } from 'react';
import { Bell } from 'shared/icons';
import {
NotificationContainer,
GlobalActions,
ProjectActions,
2020-04-21 01:04:27 +02:00
ProjectMeta,
ProjectName,
ProjectTabs,
ProjectTab,
2020-04-10 04:40:22 +02:00
NavbarWrapper,
NavbarHeader,
Breadcrumbs,
BreadcrumpSeparator,
ProfileIcon,
ProfileContainer,
ProfileNameWrapper,
ProfileNamePrimary,
ProfileNameSecondary,
} from './Styles';
type NavBarProps = {
onProfileClick: (bottom: number, right: number) => void;
onNotificationClick: () => void;
2020-04-21 01:04:27 +02:00
bgColor: string;
2020-04-20 05:02:55 +02:00
firstName: string;
lastName: string;
initials: string;
2020-04-10 04:40:22 +02:00
};
2020-04-21 01:04:27 +02:00
const NavBar: React.FC<NavBarProps> = ({
onProfileClick,
onNotificationClick,
firstName,
lastName,
initials,
bgColor,
}) => {
2020-04-10 04:40:22 +02:00
const $profileRef: any = useRef(null);
const handleProfileClick = () => {
console.log('click');
const boundingRect = $profileRef.current.getBoundingClientRect();
onProfileClick(boundingRect.bottom, boundingRect.right);
};
return (
<NavbarWrapper>
<NavbarHeader>
<ProjectActions>
2020-04-21 01:04:27 +02:00
<ProjectMeta>
<ProjectName>Production Team</ProjectName>
</ProjectMeta>
<ProjectTabs>
<ProjectTab>Board</ProjectTab>
</ProjectTabs>
2020-04-10 04:40:22 +02:00
</ProjectActions>
<GlobalActions>
<NotificationContainer onClick={onNotificationClick}>
<Bell color="#c2c6dc" size={20} />
</NotificationContainer>
<ProfileContainer>
<ProfileNameWrapper>
2020-04-20 05:02:55 +02:00
<ProfileNamePrimary>
{firstName} {lastName}
</ProfileNamePrimary>
2020-04-10 04:40:22 +02:00
<ProfileNameSecondary>Manager</ProfileNameSecondary>
</ProfileNameWrapper>
2020-04-21 01:04:27 +02:00
<ProfileIcon ref={$profileRef} onClick={handleProfileClick} bgColor={bgColor}>
2020-04-20 05:02:55 +02:00
{initials}
2020-04-10 04:40:22 +02:00
</ProfileIcon>
</ProfileContainer>
</GlobalActions>
</NavbarHeader>
</NavbarWrapper>
);
};
export default NavBar;