-
-
Notifications
You must be signed in to change notification settings - Fork 631
/
Copy pathtest.tsx
47 lines (38 loc) · 776 Bytes
/
test.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
43
44
45
46
47
import React from 'react';
import {Box, Text} from '../../src/index.js';
const getBackgroundForStatus = (status: string): string | undefined => {
switch (status) {
case 'runs': {
return 'yellow';
}
case 'pass': {
return 'green';
}
case 'fail': {
return 'red';
}
default: {
return undefined;
}
}
};
type Properties = {
readonly status: string;
readonly path: string;
};
function Test({status, path}: Properties) {
return (
<Box>
<Text color="black" backgroundColor={getBackgroundForStatus(status)}>
{` ${status.toUpperCase()} `}
</Text>
<Box marginLeft={1}>
<Text dimColor>{path.split('/')[0]}/</Text>
<Text bold color="white">
{path.split('/')[1]}
</Text>
</Box>
</Box>
);
}
export default Test;