diff --git a/.gitignore b/.gitignore index d37decea..6c743ae5 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ config.js # misc .DS_Store +/.idea *.pem # debug diff --git a/components/UI/ServiceLink.js b/components/UI/ServiceLink.js index 810d2d44..6efb65d6 100644 --- a/components/UI/ServiceLink.js +++ b/components/UI/ServiceLink.js @@ -19,24 +19,70 @@ const LockIconWrapper = styled(Icon)` } `; -const ServiceLink = forwardRef(({ name, href, selected, passwordProtected }, ref) => { +const BlockLink = styled(Link)` + display: block; +`; + +const NotificationBadge = styled.span` + justify-self: end; + padding: 0 calc(var(--margin) / 4); + line-height: var(--line-height); + color: rgb(255 255 255); + background-color: var(--color-notification); + + > small { + font-weight: 600; + } +`; + +const Avatar = styled.img` + position: relative; + float: left; + width: 2rem; + height: 2rem; + background-color: var(--color-foreground); + + &.placeholder { + backdrop-filter: invert(100%); + } +`; + +const ServiceLink = forwardRef(({ name, href, selected, passwordProtected, notifications, avatar }, ref) => { const { t } = useTranslation(); return ( - - { /* Tell if this is our active item by displaying an arrow */ } - { selected && } - + + ) + } + + { name } { /* Show a lock icon if this Link is password protected */ } { passwordProtected && } - + + { /* Tell if this is our active item by displaying an arrow */ } + { selected && + + → + + } + { /* Show notification badge if there are notifications */ } + { !selected && notifications > 0 && + + + + { notifications < 100 ? notifications : '99+' } + + + + } ); }); diff --git a/components/UI/ServiceSubmenu.js b/components/UI/ServiceSubmenu.js index 468918fc..6e2e8b34 100644 --- a/components/UI/ServiceSubmenu.js +++ b/components/UI/ServiceSubmenu.js @@ -35,7 +35,7 @@ const Submenu = styled.aside` } `; -export function ServiceSubmenu({ title, icon, subheadline, items, disabled }) { +export function ServiceSubmenu({ title, icon, subheadline, items, disabled, onClick }) { const { t } = useTranslation(); const [isOpen, setIsOpen] = useState(false); const [value, setValue] = useState(''); @@ -53,7 +53,7 @@ export function ServiceSubmenu({ title, icon, subheadline, items, disabled }) { { title && title } + onClick={onClick || handleMenuToggle}> { icon ? icon : @@ -63,7 +63,7 @@ export function ServiceSubmenu({ title, icon, subheadline, items, disabled }) { } - { isOpen && ( + { isOpen && items && ( { subheadline &&

{ subheadline }

}