import React from 'react'; import { IconWrapper, ClickZone } from './styled'; import data from './data'; type Props = { id?: string; glyph: string; onClick?: (e: React.MouseEvent) => void; onBlur?: () => void; style?: Record; isActive?: boolean; isDisabled?: boolean; }; const Icon: React.FC = ({ glyph, id, onClick, onBlur, style, isActive, isDisabled, }: Props) => { const { Normal, Hover } = data[glyph]; return ( {Normal && } {Hover && } {isActive && Hover ? : null} { // do something } : onClick } onMouseDown={(e) => { e.preventDefault(); }} onBlur={onBlur} /> ); }; Icon.defaultProps = { id: '', onClick: () => { // do something }, onBlur: () => { // do something }, style: {}, isActive: false, isDisabled: false, }; export default Icon;