import React from 'react'; import classnames from 'classnames'; import {Collapsible} from 'display-library/Collapsible'; import {Inventory} from 'types/VariantTypes'; import './SizeDropdown.scss'; import {SIZE_DROPDOWN_DEFAULT_TEXT} from '../constants'; interface Props { className?: string; options: Array; selectedSize?: string; setSize: Function; reload?: boolean; } const SizeDropdownView: React.FC = ({ className, options, setSize, selectedSize }) => { const handleClick = (option: Inventory) => { setSize(option.size); }; const renderOptions = (): JSX.Element[] => { return options.map((option: Inventory) => (
option.can_sell && handleClick(option)} className="SizeDropdown__option" data-disabled={!option.can_sell} >
{option.size}
)); }; return ( <>
{renderOptions()}
); }; export default SizeDropdownView;