forked from feast-dev/feast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTagsDisplay.tsx
More file actions
37 lines (34 loc) · 1012 Bytes
/
TagsDisplay.tsx
File metadata and controls
37 lines (34 loc) · 1012 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
import React from "react";
import {
EuiDescriptionList,
EuiDescriptionListDescription,
EuiDescriptionListTitle,
} from "@elastic/eui";
import EuiCustomLink from "./EuiCustomLink";
interface TagsDisplayProps {
createLink?: (key: string, value: string) => string;
tags: Record<string, string>;
}
const TagsDisplay = ({ tags, createLink }: TagsDisplayProps) => {
return (
<EuiDescriptionList textStyle="reverse">
{Object.entries(tags).map(([key, value]) => {
return (
<React.Fragment key={key}>
<EuiDescriptionListTitle>{key}</EuiDescriptionListTitle>
<EuiDescriptionListDescription>
{createLink ? (
<EuiCustomLink to={createLink(key, value)}>
{value}
</EuiCustomLink>
) : (
value
)}
</EuiDescriptionListDescription>
</React.Fragment>
);
})}
</EuiDescriptionList>
);
};
export default TagsDisplay;