import { useFormatsQuery, Format, FormatsQuery, FormatsQueryVariables } from '../../gql'
import Selector from './Selector'
interface IFormatSelector {
value?: Format
onChange: GenericEventHandler
name?: string
label?: string
className?: string
}
const FormatSelectItem = ({ data }: { data: Format }) => {
return (
{data.name}
{data.description}
)
}
const FormatSelector = ({
value,
onChange,
name = 'type',
label = 'Training type',
className = 'training-type',
}: IFormatSelector) => {
return (
SelectorItem={FormatSelectItem}
name={name}
value={value}
onChange={onChange}
query={useFormatsQuery}
searchKeys={['name_contains', 'description_contains']}
className={className}
/>
)
}
export default FormatSelector