From 533b9511c95b9009fabd7d4d955b2de01d60f99c Mon Sep 17 00:00:00 2001 From: Jordan Knott Date: Tue, 5 Jan 2021 19:47:52 -0600 Subject: [PATCH] feat: add alternate project finder to left navbar --- .../src/shared/components/TopNavbar/Styles.ts | 41 ++++++++++- .../src/shared/components/TopNavbar/index.tsx | 68 +++++++++++-------- frontend/src/shared/icons/Taskcafe.tsx | 21 ++++-- 3 files changed, 95 insertions(+), 35 deletions(-) diff --git a/frontend/src/shared/components/TopNavbar/Styles.ts b/frontend/src/shared/components/TopNavbar/Styles.ts index e70d04d..49b8035 100644 --- a/frontend/src/shared/components/TopNavbar/Styles.ts +++ b/frontend/src/shared/components/TopNavbar/Styles.ts @@ -41,12 +41,51 @@ export const BreadcrumpSeparator = styled.span` font-size: 18px; margin: 0px 10px; `; +export const ProjectInfo = styled.div` + display: flex; + flex-direction: column; + flex: 1; +`; + +export const ProjectSwitchInner = styled.div` + border-radius: 12px; + height: 48px; + width: 48px; + box-shadow: inset 0 -2px rgba(0, 0, 0, 0.05); + align-items: center; + background: #cbd4db; + display: flex; + flex: 0 0 auto; + flex-direction: column; + justify-content: center; + + background-color: ${props => props.theme.colors.primary}; +`; + +export const ProjectSwitch = styled.div` + align-self: center; + position: relative; + margin-right: 16px; + cursor: pointer; + &::after { + border-radius: 12px; + bottom: 0; + content: ''; + left: 0; + pointer-events: none; + position: absolute; + right: 0; + top: 0; + } + &:hover::after { + background-color: rgba(0, 0, 0, 0.05); + } +`; export const ProjectActions = styled.div` flex: 1; align-items: flex-start; display: flex; - flex-direction: column; min-width: 1px; `; diff --git a/frontend/src/shared/components/TopNavbar/index.tsx b/frontend/src/shared/components/TopNavbar/index.tsx index 9ddcae5..3fcedf7 100644 --- a/frontend/src/shared/components/TopNavbar/index.tsx +++ b/frontend/src/shared/components/TopNavbar/index.tsx @@ -7,6 +7,7 @@ import { RoleCode } from 'shared/generated/graphql'; import NOOP from 'shared/utils/noop'; import { useHistory } from 'react-router'; import { + ProjectInfo, NavbarLink, TaskcafeLogo, TaskcafeTitle, @@ -14,6 +15,7 @@ import { LogoContainer, NavSeparator, IconContainerWrapper, + ProjectSwitch, ProjectNameWrapper, ProjectNameSpan, ProjectNameTextarea, @@ -33,6 +35,7 @@ import { ProfileNameSecondary, ProjectMember, ProjectMembers, + ProjectSwitchInner, } from './Styles'; type IconContainerProps = { @@ -220,43 +223,50 @@ const NavBar: React.FC = ({ }; const history = useHistory(); const { showPopup } = usePopup(); + const $finder = useRef(null); return ( - + onOpenProjectFinder($finder)}> + + + + + + + {name && ( + + )} + {name && ( - + + {menuType && + menuType.map((menu, idx) => { + return ( + { + // TODO + }} + > + {menu.name} + + ); + })} + )} - - {name && ( - - {menuType && - menuType.map((menu, idx) => { - return ( - { - // TODO - }} - > - {menu.name} - - ); - })} - - )} + - Taskcafé diff --git a/frontend/src/shared/icons/Taskcafe.tsx b/frontend/src/shared/icons/Taskcafe.tsx index 4853809..2bbd6ff 100644 --- a/frontend/src/shared/icons/Taskcafe.tsx +++ b/frontend/src/shared/icons/Taskcafe.tsx @@ -1,18 +1,29 @@ import React from 'react'; import Icon, { IconProps } from './Icon'; -const Taskcafe: React.FC = ({ width = '16px', height = '16px', className }) => { +type TaskcafeProps = { + innerColor?: string; + outerColor?: string; +} & IconProps; + +const Taskcafe: React.FC = ({ + innerColor = '#262c49', + outerColor = '#7367f0', + width = '16px', + height = '16px', + className, +}) => { return ( - + = ({ width = '16px', height = '16px', classN );