Improve readability of unread indicator
This commit is contained in:
parent
d92911f475
commit
0f635af8a9
2 changed files with 30 additions and 16 deletions
|
@ -5166,18 +5166,18 @@ button.module-image__border-overlay:focus {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__unread-count {
|
&__unread-indicator {
|
||||||
$size: 16px;
|
$size: 18px;
|
||||||
|
|
||||||
@include font-caption-bold;
|
@include font-caption-bold;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
|
box-sizing: content-box;
|
||||||
color: $color-white;
|
color: $color-white;
|
||||||
font-size: 10px;
|
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
height: $size;
|
height: $size;
|
||||||
line-height: $size;
|
line-height: $size;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
margin-top: 2px;
|
margin-top: 1px;
|
||||||
min-width: $size;
|
min-width: $size;
|
||||||
padding-left: 3px;
|
padding-left: 3px;
|
||||||
padding-right: 3px;
|
padding-right: 3px;
|
||||||
|
@ -5189,6 +5189,7 @@ button.module-image__border-overlay:focus {
|
||||||
|
|
||||||
.module-conversation-list--width-narrow & {
|
.module-conversation-list--width-narrow & {
|
||||||
margin-left: 6px;
|
margin-left: 6px;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
@include light-theme {
|
@include light-theme {
|
||||||
|
@ -5198,22 +5199,26 @@ button.module-image__border-overlay:focus {
|
||||||
background-color: $color-ultramarine-dawn;
|
background-color: $color-ultramarine-dawn;
|
||||||
}
|
}
|
||||||
|
|
||||||
&--multiple-digits {
|
&--two-digits,
|
||||||
|
&--many {
|
||||||
padding-left: 4px;
|
padding-left: 4px;
|
||||||
padding-right: 4px;
|
padding-right: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&--many {
|
&--many {
|
||||||
font-size: 9px;
|
font-size: 10px;
|
||||||
padding-right: 2px;
|
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
content: '+';
|
content: '+';
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
font-size: 8px;
|
font-size: 9px;
|
||||||
margin-bottom: 3px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&--marked-unread {
|
||||||
|
padding-left: 0;
|
||||||
|
padding-right: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__content {
|
&__content {
|
||||||
|
|
|
@ -175,7 +175,7 @@ export const BaseConversationListItem: FunctionComponent<PropsType> = React.memo
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{messageStatusIcon}
|
{messageStatusIcon}
|
||||||
{isUnread && <UnreadCount count={unreadCount} />}
|
{isUnread && <UnreadIndicator count={unreadCount} />}
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
@ -233,14 +233,23 @@ export const BaseConversationListItem: FunctionComponent<PropsType> = React.memo
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
function UnreadCount({ count = 0 }: Readonly<{ count?: number }>) {
|
function UnreadIndicator({ count = 0 }: Readonly<{ count?: number }>) {
|
||||||
|
let classModifier: undefined | string;
|
||||||
|
if (count > 99) {
|
||||||
|
classModifier = 'many';
|
||||||
|
} else if (count > 9) {
|
||||||
|
classModifier = 'two-digits';
|
||||||
|
} else if (count === 0) {
|
||||||
|
classModifier = 'marked-unread';
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={classNames(`${BASE_CLASS_NAME}__unread-count`, {
|
className={classNames(
|
||||||
[`${BASE_CLASS_NAME}__unread-count--multiple-digits`]:
|
`${BASE_CLASS_NAME}__unread-indicator`,
|
||||||
count > 9 && count <= 99,
|
classModifier &&
|
||||||
[`${BASE_CLASS_NAME}__unread-count--many`]: count > 99,
|
`${BASE_CLASS_NAME}__unread-indicator--${classModifier}`
|
||||||
})}
|
)}
|
||||||
>
|
>
|
||||||
{Boolean(count) && Math.min(count, 99)}
|
{Boolean(count) && Math.min(count, 99)}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue