import React, { forwardRef, ElementRef, ComponentProps } from 'react' import { IconCheck } from '~/components' import { StitchedCSS, styled } from '~/theme' import { Badge, BadgeType, BadgeVariant } from '../Badge' const Container = styled('div', {}) const IconContainer = styled('div', { color: '$TextPrimary', }) export type ChipType = 'light' | 'outline' export interface ChipItemProps extends ComponentProps { value: string isSelected?: boolean type?: ChipType } export const ChipItem = forwardRef, ChipItemProps>( (properties, forwardedRef) => { const { type: chipType = 'light', isSelected = false, ...remainingProps } = properties const checkedIcon = ( ) const leftArea = isSelected ? checkedIcon : null function getBadgeType(chipType: ChipType, isSelected: boolean): BadgeType { if (isSelected) { return chipType === 'light' ? 'primary' : 'primary' } else { return chipType === 'light' ? 'action' : 'action' } } function getBadgeVariant( chipType: ChipType, isSelected: boolean ): BadgeVariant { if (isSelected) { return chipType === 'light' ? 'light' : 'outline' } else { return chipType === 'light' ? 'light' : 'outline' } } const badgeType = getBadgeType(chipType, isSelected) const badgeVariant = getBadgeVariant(chipType, isSelected) const ChipCSS: StitchedCSS = { cursor: 'pointer', color: '$TextPrimary !important', } return ( ) } ) ChipItem.displayName = 'ChipItem'