Add animation on hover in sidebar

Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
Ajay Bura 2021-12-08 11:11:05 +05:30
parent c1e3645d57
commit e20b9d054d
3 changed files with 15 additions and 4 deletions

View file

@ -4,7 +4,7 @@ import './Tooltip.scss';
import Tippy from '@tippyjs/react'; import Tippy from '@tippyjs/react';
function Tooltip({ function Tooltip({
className, placement, content, children, className, placement, content, delay, children,
}) { }) {
return ( return (
<Tippy <Tippy
@ -14,7 +14,7 @@ function Tooltip({
arrow={false} arrow={false}
maxWidth={250} maxWidth={250}
placement={placement} placement={placement}
delay={[0, 0]} delay={delay}
duration={[100, 0]} duration={[100, 0]}
> >
{children} {children}
@ -25,12 +25,14 @@ function Tooltip({
Tooltip.defaultProps = { Tooltip.defaultProps = {
placement: 'top', placement: 'top',
className: '', className: '',
delay: [200, 0],
}; };
Tooltip.propTypes = { Tooltip.propTypes = {
className: PropTypes.string, className: PropTypes.string,
placement: PropTypes.string, placement: PropTypes.string,
content: PropTypes.node.isRequired, content: PropTypes.node.isRequired,
delay: PropTypes.arrayOf(PropTypes.number),
children: PropTypes.node.isRequired, children: PropTypes.node.isRequired,
}; };

View file

@ -14,6 +14,16 @@
margin: 0 !important; margin: 0 !important;
} }
& .avatar-container,
& .notification-badge {
transition: transform 200ms cubic-bezier(0, 0.8, 0.67, 0.97);
}
&:hover .avatar-container {
transform: translateX(4px)
}
&:hover .notification-badge {
transform: translate(calc(20% + 4px), -20%);
}
&:focus { &:focus {
outline: none; outline: none;
} }
@ -33,7 +43,7 @@
width: 3px; width: 3px;
height: 12px; height: 12px;
background-color: var(--ic-surface-normal); background-color: var(--tc-surface-high);
border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0;
transition: height 200ms linear; transition: height 200ms linear;

View file

@ -175,7 +175,6 @@ function SideBar() {
notificationCount={dmsNoti !== null ? abbreviateNumber(dmsNoti.total) : 0} notificationCount={dmsNoti !== null ? abbreviateNumber(dmsNoti.total) : 0}
isAlert={dmsNoti?.highlight > 0} isAlert={dmsNoti?.highlight > 0}
/> />
<SidebarAvatar onClick={() => openPublicRooms()} tooltip="Public rooms" iconSrc={HashSearchIC} />
</div> </div>
<div className="sidebar-divider" /> <div className="sidebar-divider" />
<div className="space-container"> <div className="space-container">