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 hashIcon from "../../assets/icons/channel.svg?url";
import lockHashIcon from "../../assets/icons/channel.private.svg?url";
export default function ChannelIcon({ personal = false, ...rest }) {
import HashIcon from "../../assets/icons/channel.svg";
import LockHashIcon from "../../assets/icons/channel.private.svg";
import styled from "styled-components";
const Styled = styled.div`
display: flex;
&.muted path {
fill: #d0d5dd;
}
`;
export default function ChannelIcon({ personal = false, muted = false }) {
return (
<img
src={personal ? lockHashIcon : hashIcon}
alt="channel icon"
{...rest}
/>
<Styled className={muted ? "muted" : ""}>
{personal ? <LockHashIcon /> : <HashIcon />}
</Styled>
);
}
+5 -3
View File
@@ -127,11 +127,13 @@ const NavItem = ({ id, setFiles, toggleRemoveConfirm }) => {
onContextMenu={handleContextMenuEvent}
ref={drop}
key={id}
className={`link ${isActive ? "drop_over" : ""}`}
className={`link ${isActive ? "drop_over" : ""} ${
muted ? "muted" : ""
}`}
to={`/chat/channel/${id}`}
>
<div className="name" title={name}>
<ChannelIcon personal={!is_public} />
<div className={`name`} title={name}>
<ChannelIcon personal={!is_public} muted={muted} />
<span className={`txt ${unreads == 0 ? "read" : ""}`}>{name}</span>
</div>
<div className="icons">
+15 -2
View File
@@ -50,7 +50,7 @@ const Styled = styled(NavLink)`
height: 20px;
min-width: 20px;
border-radius: 50%;
background: #bfbfbf;
background: #22ccee;
font-weight: 900;
font-size: 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;
}
}
`;
export default Styled;