You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
720 B
TypeScript
30 lines
720 B
TypeScript
4 years ago
|
import moment from 'moment';
|
||
|
import React from 'react';
|
||
|
import styled from 'styled-components';
|
||
|
|
||
|
const DateBreakContainer = styled.div``;
|
||
|
|
||
|
const DateBreakText = styled.div`
|
||
|
margin-top: 0.3rem;
|
||
|
margin-bottom: 0.3rem;
|
||
|
letter-spacing: 0.6px;
|
||
|
font-size: 0.8rem;
|
||
|
font-weight: bold;
|
||
|
text-align: center;
|
||
|
|
||
4 years ago
|
color: var(--color-last-seen-indicator-text);
|
||
4 years ago
|
`;
|
||
|
|
||
4 years ago
|
export const MessageDateBreak = (props: { timestamp: number; messageId: string }) => {
|
||
|
const { timestamp, messageId } = props;
|
||
|
const text = moment(timestamp).calendar(undefined, {
|
||
4 years ago
|
sameElse: 'llll',
|
||
|
});
|
||
4 years ago
|
|
||
4 years ago
|
return (
|
||
4 years ago
|
<DateBreakContainer id={`date-break-${messageId}`}>
|
||
4 years ago
|
<DateBreakText>{text}</DateBreakText>
|
||
|
</DateBreakContainer>
|
||
|
);
|
||
|
};
|