import { motion } from 'framer-motion'; import PropTypes from 'prop-types'; import { Checkmark } from '../../assets/icons'; import { clsm, noop } from '../../utils'; import { createAnimationProps } from '../../helpers/animationPropsHelper'; import NoImageSrcIcon from './NoImageSrcIcon'; import Spinner from '../Spinner'; export const ICON_TYPE = { IMAGE: 'image', COLOR: 'color' }; const commonIconClasses = ['h-12', 'w-12', 'rounded-full']; const Icon = ({ isLoading, isSelected, CustomMarker, name, onClick, type, value }) => { let _Icon; if (type === ICON_TYPE.IMAGE) { _Icon = value ? ( {`${name} ) : ( ); } else if (type === ICON_TYPE.COLOR) { _Icon =
; } let Marker = CustomMarker; if (isLoading) { Marker = ; } else if (isSelected) { Marker = ( ); } return ( ); }; Icon.propTypes = { CustomMarker: PropTypes.object, isLoading: PropTypes.bool, isSelected: PropTypes.bool, name: PropTypes.string, onClick: PropTypes.func, type: PropTypes.oneOf(Object.values(ICON_TYPE)).isRequired, value: PropTypes.string }; Icon.defaultProps = { CustomMarker: null, isLoading: false, isSelected: false, name: '', onClick: noop, value: '' }; export default Icon;