/** * Copyright (c) 2019 Paul Armstrong */ import * as Theme from '../theme'; import { BuildMetaItem } from '@build-tracker/build'; import Button from './Button'; import CloseIcon from '../icons/Close'; import React from 'react'; import TextLink from './TextLink'; import { StyleProp, StyleSheet, Text, TextStyle, View } from 'react-native'; import { Table, Tbody, Td, Th, Tr } from './Table'; interface Props { closeButtonLabel?: string; data: Array<[string, BuildMetaItem]>; footer?: React.ReactElement; icon?: React.ComponentType<{ style?: StyleProp }>; onClose?: () => void; title: string; } function getMetaValue(val: string | BuildMetaItem): string { // @ts-ignore return typeof val === 'object' && val.hasOwnProperty('value') ? val.value : val; } function getMetaUrl(val: string | BuildMetaItem): string | undefined { // @ts-ignore return typeof val === 'object' && val.hasOwnProperty('url') ? val.url : undefined; } const TabularMetadata = (props: Props): React.ReactElement => { const { closeButtonLabel, data, footer, icon, onClose, title } = props; const handleClose = React.useCallback(() => { onClose && onClose(); }, [onClose]); return ( {title}