import { Button } from '@components/common/ui/Button.js'; import { VariantAttributeGroupProps, VariantOptionItemProps } from '@components/frontStore/catalog/VariantSelector.js'; import React from 'react'; const DefaultVariantOptionItem: React.FC = ({ option, attribute, isSelected, onSelect }) => { // An option is unavailable when no real variant exists for it given the // other selected attributes. `disabled` drives the Button's built-in // disabled treatment (opacity + pointer-events-none); `aria-disabled` // announces it to assistive tech. The `un-available` class is kept as a // theming hook. const isUnavailable = option.available === false; let className = 'group '; if (isSelected) { className += 'selected'; } if (isUnavailable) { className += 'un-available'; } return (
  • ); }; const DefaultVariantAttribute: React.FC = ({ attribute, options, onSelect, OptionItem = DefaultVariantOptionItem }) => { return (
    {attribute.attributeName}
      {options.map((option) => ( ))}
    ); }; export { DefaultVariantAttribute, DefaultVariantOptionItem };