-
-
Notifications
You must be signed in to change notification settings - Fork 136
/
Copy pathAvroMetadata.tsx
43 lines (37 loc) · 969 Bytes
/
AvroMetadata.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
import React from 'react';
import * as S from './MessageContent.styled';
export interface AvroMetadataProps {
deserializeProperties?: { [key: string]: unknown | undefined };
}
const AvroMetadata: React.FC<AvroMetadataProps> = ({
deserializeProperties,
}) => {
if (
!deserializeProperties ||
deserializeProperties.type !== 'AVRO' ||
!deserializeProperties.name ||
!deserializeProperties.schemaId
) {
return null;
}
if (
typeof deserializeProperties.name !== 'string' ||
typeof deserializeProperties.schemaId !== 'number'
) {
return null;
}
return (
<S.Metadata>
<S.MetadataLabel>Value Type</S.MetadataLabel>
<span>
<S.MetadataValue>
{deserializeProperties.name.split('.').pop()}
</S.MetadataValue>
<S.MetadataMeta>
Schema Id: {deserializeProperties.schemaId}
</S.MetadataMeta>
</span>
</S.Metadata>
);
};
export default AvroMetadata;