-
Notifications
You must be signed in to change notification settings - Fork 226
Expand file tree
/
Copy pathLastUpdated.tsx
More file actions
38 lines (32 loc) · 839 Bytes
/
LastUpdated.tsx
File metadata and controls
38 lines (32 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import * as React from 'react';
import { RepoPushIcon } from '@primer/octicons-react';
import styled from 'styled-components';
import { humanizeRelativeTime } from '../../pure/time';
const IconContainer = styled.span`
flex-grow: 0;
text-align: right;
margin-right: 0;
`;
const Duration = styled.span`
text-align: left;
width: 8em;
margin-left: 0.5em;
`;
type Props = { lastUpdated?: number };
const LastUpdated = ({ lastUpdated }: Props) => (
// lastUpdated will be undefined for older results that were
// created before the lastUpdated field was added.
Number.isFinite(lastUpdated) ? (
<>
<IconContainer>
<RepoPushIcon size={16} />
</IconContainer>
<Duration>
{humanizeRelativeTime(lastUpdated)}
</Duration>
</>
) : (
<></>
)
);
export default LastUpdated;