Left pane spacing tweaks

This commit is contained in:
Evan Hahn 2021-10-14 15:21:10 -05:00 committed by GitHub
parent da9df293c6
commit 29e6ba8f10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 21 deletions

View file

@ -51,7 +51,7 @@ import {
SaveAvatarToDiskActionType,
} from '../types/Avatar';
const MIN_WIDTH = 119;
const MIN_WIDTH = 109;
const MIN_SNAP_WIDTH = 280;
const MIN_FULL_WIDTH = 320;
const MAX_WIDTH = 380;

View file

@ -173,11 +173,7 @@ export const BaseConversationListItem: FunctionComponent<PropsType> = React.memo
</div>
)}
{messageStatusIcon}
{isUnread && (
<div className={`${BASE_CLASS_NAME}__unread-count`}>
{formatUnreadCount(unreadCount)}
</div>
)}
{isUnread && <UnreadCount count={unreadCount} />}
</div>
) : null}
</div>
@ -235,12 +231,15 @@ export const BaseConversationListItem: FunctionComponent<PropsType> = React.memo
}
);
function formatUnreadCount(count: undefined | number): string {
if (!count) {
return '';
}
if (count >= 99) {
return '99+';
}
return String(count);
function UnreadCount({ count = 0 }: Readonly<{ count?: number }>) {
return (
<div
className={classNames(
`${BASE_CLASS_NAME}__unread-count`,
count > 99 && `${BASE_CLASS_NAME}__unread-count--big`
)}
>
{Boolean(count) && Math.min(count, 99)}
</div>
);
}