feat: update unread count UX

This commit is contained in:
zerosoul
2022-04-12 16:04:55 +08:00
parent 3566cffbc5
commit 53e98b5298
3 changed files with 34 additions and 14 deletions
+13 -8
View File
@@ -1,12 +1,17 @@
// import React from 'react'; // import React from 'react';
import hashIcon from "../../assets/icons/channel.svg?url"; import HashIcon from "../../assets/icons/channel.svg";
import lockHashIcon from "../../assets/icons/channel.private.svg?url"; import LockHashIcon from "../../assets/icons/channel.private.svg";
export default function ChannelIcon({ personal = false, ...rest }) { import styled from "styled-components";
const Styled = styled.div`
display: flex;
&.muted path {
fill: #d0d5dd;
}
`;
export default function ChannelIcon({ personal = false, muted = false }) {
return ( return (
<img <Styled className={muted ? "muted" : ""}>
src={personal ? lockHashIcon : hashIcon} {personal ? <LockHashIcon /> : <HashIcon />}
alt="channel icon" </Styled>
{...rest}
/>
); );
} }
+5 -3
View File
@@ -127,11 +127,13 @@ const NavItem = ({ id, setFiles, toggleRemoveConfirm }) => {
onContextMenu={handleContextMenuEvent} onContextMenu={handleContextMenuEvent}
ref={drop} ref={drop}
key={id} key={id}
className={`link ${isActive ? "drop_over" : ""}`} className={`link ${isActive ? "drop_over" : ""} ${
muted ? "muted" : ""
}`}
to={`/chat/channel/${id}`} to={`/chat/channel/${id}`}
> >
<div className="name" title={name}> <div className={`name`} title={name}>
<ChannelIcon personal={!is_public} /> <ChannelIcon personal={!is_public} muted={muted} />
<span className={`txt ${unreads == 0 ? "read" : ""}`}>{name}</span> <span className={`txt ${unreads == 0 ? "read" : ""}`}>{name}</span>
</div> </div>
<div className="icons"> <div className="icons">
+15 -2
View File
@@ -50,7 +50,7 @@ const Styled = styled(NavLink)`
height: 20px; height: 20px;
min-width: 20px; min-width: 20px;
border-radius: 50%; border-radius: 50%;
background: #bfbfbf; background: #22ccee;
font-weight: 900; font-weight: 900;
font-size: 10px; font-size: 10px;
line-height: 10px; line-height: 10px;
@@ -62,8 +62,21 @@ const Styled = styled(NavLink)`
} }
} }
} }
&:hover > .icons > .setting { &.muted {
.name .txt {
color: #d0d5dd;
}
.icons .badge {
background: #bfbfbf;
}
}
&:hover > .icons > {
.badge {
display: none;
}
.setting {
visibility: visible; visibility: visible;
} }
}
`; `;
export default Styled; export default Styled;