-
Notifications
You must be signed in to change notification settings - Fork 4
/
Timestamp.tsx
42 lines (38 loc) · 1.12 KB
/
Timestamp.tsx
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
39
40
41
42
import * as React from "react";
import { TimestampData } from "../interfaces";
import { Panel } from "library-simplified-reusable-components";
export interface TimestampProps {
timestamp: TimestampData;
}
export default class Timestamp extends React.Component<TimestampProps, {}> {
render(): JSX.Element {
const { timestamp } = this.props;
const exception = (
<section className="well exception">
<pre>{timestamp.exception}</pre>
</section>
);
const achievements = (
<section className="well">
<pre>{timestamp.achievements}</pre>
</section>
);
const content = (
<ul>
<li>Duration: {timestamp.duration} seconds</li>
{timestamp.achievements && <li>{achievements}</li>}
{timestamp.exception && <li>{exception}</li>}
</ul>
);
// If the timestamp has an exception, it should start out expanded.
return (
<Panel
id={`timestamp-${timestamp.id}`}
headerText={timestamp.start}
style={timestamp.exception ? "danger" : "success"}
content={content}
collapsible={false}
/>
);
}
}