fix(messaging): only show date if date changes

This commit is contained in:
Paul
2021-12-24 14:41:33 +00:00
parent 153493e4dc
commit ac832bfe42
2 changed files with 12 additions and 8 deletions

View File

@@ -37,15 +37,15 @@ const Unread = styled.div`
`;
interface Props {
date: Date;
date?: Date;
unread?: boolean;
}
export default function DateDivider(props: Props) {
export default function DateDivider({ unread, date }: Props) {
return (
<Base unread={props.unread}>
{props.unread && <Unread>NEW</Unread>}
<time>{dayjs(props.date).format("LL")}</time>
<Base unread={unread}>
{unread && <Unread>NEW</Unread>}
{date && <time>{dayjs(date).format("LL")}</time>}
</Base>
);
}