import React, {Fragment, FunctionComponent} from 'react'
import styles from './TableGraphs.scss'
interface GroupKey {
[x: string]: string
}
interface Props {
name: string
id: string
isSelected: boolean
groupKey: GroupKey
onSelect: (name: string) => void
}
const getName = (groupKey: GroupKey): JSX.Element[] => {
const noNameKeys = ['_start', '_stop']
return Object.entries(groupKey)
.filter(([k]) => !noNameKeys.includes(k))
.map(([k, v], i) => {
return (
{k}
=
{v}
)
})
}
export const TableSidebarItem: FunctionComponent = (props: Props) => {
const {name, isSelected, groupKey, onSelect} = props
const handleClick = () => onSelect(name)
return (
{getName(groupKey)}
)
}