UNPKG

@open-tender/store

Version:

A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our in-store POS API

20 lines (19 loc) 852 B
import { useAppSelector } from '../app/hooks'; import { selectKioskConfig } from '../slices'; var ItemSize = function (_a) { var _b; var sizeGroup = _a.sizeGroup, toggleSize = _a.toggleSize, children = _a.children; var config = useAppSelector(selectKioskConfig).itemSize; var appliedOption = (_b = sizeGroup === null || sizeGroup === void 0 ? void 0 : sizeGroup.options) === null || _b === void 0 ? void 0 : _b.find(function (i) { return i.quantity > 0; }); var appliedId = (appliedOption === null || appliedOption === void 0 ? void 0 : appliedOption.id) || null; var handlers = { toggleSize: toggleSize }; if (!config || !sizeGroup) return null; return children({ config: config, handlers: handlers, sizeGroup: sizeGroup, appliedId: appliedId }); }; export default ItemSize;