Outbound link previews
This commit is contained in:
parent
bb3ab816dd
commit
313faab774
25 changed files with 2136 additions and 641 deletions
23
ts/components/conversation/LinkPreviewDate.tsx
Normal file
23
ts/components/conversation/LinkPreviewDate.tsx
Normal file
|
@ -0,0 +1,23 @@
|
|||
import * as React from 'react';
|
||||
import moment, { Moment } from 'moment';
|
||||
import { isLinkPreviewDateValid } from '../../linkPreviews/isLinkPreviewDateValid';
|
||||
|
||||
interface Props {
|
||||
date: null | number;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export const LinkPreviewDate: React.FC<Props> = ({
|
||||
date,
|
||||
className = '',
|
||||
}: Props) => {
|
||||
const dateMoment: Moment | null = isLinkPreviewDateValid(date)
|
||||
? moment(date)
|
||||
: null;
|
||||
|
||||
return dateMoment ? (
|
||||
<time className={className} dateTime={dateMoment.toISOString()}>
|
||||
{dateMoment.format('ll')}
|
||||
</time>
|
||||
) : null;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue