2021-06-20 17:31:53 +01:00
|
|
|
import styled, { css } from "styled-components";
|
2021-07-06 19:29:27 +01:00
|
|
|
|
2021-07-06 19:29:09 +01:00
|
|
|
import { dayjs } from "../../context/Locale";
|
2021-06-20 17:31:53 +01:00
|
|
|
|
|
|
|
const Base = styled.div<{ unread?: boolean }>`
|
2021-07-05 11:25:20 +01:00
|
|
|
height: 0;
|
|
|
|
display: flex;
|
|
|
|
user-select: none;
|
|
|
|
align-items: center;
|
|
|
|
margin: 17px 12px 5px;
|
|
|
|
border-top: thin solid var(--tertiary-foreground);
|
2021-06-20 17:31:53 +01:00
|
|
|
|
2021-07-05 11:25:20 +01:00
|
|
|
time {
|
|
|
|
margin-top: -2px;
|
2021-07-10 15:57:29 +01:00
|
|
|
font-size: 0.6875rem;
|
|
|
|
line-height: 0.6875rem;
|
2021-12-24 14:32:04 +00:00
|
|
|
padding-inline-start: 5px;
|
2021-07-08 21:01:21 +02:00
|
|
|
padding-inline-end: 5px;
|
2021-07-05 11:25:20 +01:00
|
|
|
color: var(--tertiary-foreground);
|
|
|
|
background: var(--primary-background);
|
|
|
|
}
|
2021-06-20 17:31:53 +01:00
|
|
|
|
2021-07-05 11:25:20 +01:00
|
|
|
${(props) =>
|
|
|
|
props.unread &&
|
|
|
|
css`
|
|
|
|
border-top: thin solid var(--accent);
|
|
|
|
`}
|
2021-06-20 17:31:53 +01:00
|
|
|
`;
|
|
|
|
|
|
|
|
const Unread = styled.div`
|
2021-07-05 11:25:20 +01:00
|
|
|
background: var(--accent);
|
|
|
|
color: white;
|
2021-12-24 14:32:04 +00:00
|
|
|
font-size: 7px;
|
|
|
|
padding: 2px 6px;
|
2021-07-05 11:25:20 +01:00
|
|
|
border-radius: 60px;
|
|
|
|
font-weight: 600;
|
2021-06-20 17:31:53 +01:00
|
|
|
`;
|
|
|
|
|
|
|
|
interface Props {
|
2021-07-05 11:25:20 +01:00
|
|
|
date: Date;
|
|
|
|
unread?: boolean;
|
2021-06-20 17:31:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export default function DateDivider(props: Props) {
|
2021-07-05 11:25:20 +01:00
|
|
|
return (
|
|
|
|
<Base unread={props.unread}>
|
|
|
|
{props.unread && <Unread>NEW</Unread>}
|
|
|
|
<time>{dayjs(props.date).format("LL")}</time>
|
|
|
|
</Base>
|
|
|
|
);
|
2021-06-20 17:31:53 +01:00
|
|
|
}
|