import React from 'react'; import { Icon, SemanticColor } from '../../foundation'; import { Pressable, View } from 'react-native'; import { IconChipProps } from './Chip'; import { useThrottledPressHandler } from '../../internal/utils/useThrottledPressHandler'; export function IconChip(props: IconChipProps) { const { disabled, selected, onPress, icon } = props; const backgroundColor = (() => { if (selected === true) { return disabled === true ? SemanticColor.bg_off_white : SemanticColor.bg_secondary; } return SemanticColor.bg_primary; })(); const borderColor = (() => { if (selected) { // 정의된 내용에는 border가 없지만 border를 넣지않으면 height가 줄어들기에 border를 넣고 background color와 동일하게 설정 return backgroundColor; } return SemanticColor.border_secondary; })(); const throttledPressHandler = useThrottledPressHandler(onPress, props.throttle); return ( ); }