import classNames from 'classnames'; import React, { SyntheticEvent, useCallback } from 'react'; import Icon from 'Components/Icon'; import Link from 'Components/Link/Link'; import { icons } from 'Helpers/Props'; import CheckInput from '../CheckInput'; import styles from './EnhancedSelectInputOption.css'; function handleCheckPress() { // CheckInput requires a handler. Swallow the change event because onPress will already handle it via event propagation. } export interface EnhancedSelectInputOptionProps { className?: string; id: string | number; depth?: number; isSelected: boolean; isDisabled?: boolean; isHidden?: boolean; isMultiSelect?: boolean; isMobile: boolean; children: React.ReactNode; onSelect: (...args: unknown[]) => unknown; } function EnhancedSelectInputOption({ className = styles.option, id, depth = 0, isSelected, isDisabled = false, isHidden = false, isMultiSelect = false, isMobile, children, onSelect, }: Readonly) { const handlePress = useCallback( (event: SyntheticEvent) => { event.preventDefault(); onSelect(id); }, [id, onSelect] ); return ( {depth !== 0 &&
} {isMultiSelect && ( )} {children} {isMobile && (
)} ); } export default EnhancedSelectInputOption;