import React from 'react';
import PropTypes from 'prop-types';
import RenderIf from '../RenderIf';
import { StyledOption, StyledOptionText } from './styled';
const Option = ({ option = {}, onPress = () => { }, disabled, isActive, variant, size, }) => {
    const hasIcon = !!option.icon;
    const handlePress = () => (isActive ? null : onPress(option));
    return (<StyledOption accessibilityRole="checkbox" isActive={isActive} variant={variant} disabled={disabled} onPress={handlePress} size={size}>
            <StyledOptionText variant={variant} isActive={isActive} disabled={disabled}>
                <RenderIf isTrue={hasIcon}>{option.icon} </RenderIf>
                {option.label}
            </StyledOptionText>
        </StyledOption>);
};
Option.propTypes = {
    option: PropTypes.shape({
        label: PropTypes.node,
        value: PropTypes.string,
        icon: PropTypes.node,
    }),
};
Option.defaultProps = {
    option: {},
};
export default Option;
