import React from 'react'
import { t } from 'ttag'
type ConstraintChooserItemProps = {
constraints: any[]
selections: any[]
onSelect: (selections: any[]) => any
}
const ConstraintChooserItem = ({ constraints, selections, onSelect }: ConstraintChooserItemProps) => {
const selection = selections[0]
const nextSelections = selections.slice(1)
const node = (
)
if (nextSelections.length > 0) {
const constraint = constraints.find(item => item.name === selection)
return (
<>
{node}
onSelect([selection, ...subSelections])}
/>
>
)
}
return node
}
export default ConstraintChooserItem