UNPKG

@open-tender/ui

Version:

A component library for use with the Open Tender web app

9 lines (8 loc) 628 B
import React from 'react'; import { makeProps } from '../utils'; import View from './View'; const ItemGroups = ({ config, groups, excludeSize = true, renderItemOption, renderItemGroup }) => { const optionGroups = excludeSize ? groups.filter(i => !i.isSize) : groups; return (React.createElement(View, Object.assign({}, makeProps(config, 'itemGroups')), optionGroups.map(group => renderItemGroup(group, group.options.map(option => (React.createElement(View, Object.assign({ key: `${group.id}-${option.id}` }, makeProps(config, 'itemGroups__option')), renderItemOption(group, option)))))))); }; export default ItemGroups;