| | |
| | | } |
| | | type Props = { |
| | | className?: string |
| | | trigger?: React.JSX.Element |
| | | trigger?: JSX.Element |
| | | DropDownIcon?: any |
| | | noLeft?: boolean |
| | | options: Item[] |
| | |
| | | : ( |
| | | <div |
| | | onClick={toggleShow} |
| | | className={cn(showOption && 'bg-state-base-hover', 'flex h-5 cursor-pointer items-center rounded-md pl-1 pr-0.5 text-xs font-semibold text-text-secondary hover:bg-state-base-hover')}> |
| | | <div className={cn('text-sm font-semibold', uppercase && 'uppercase', noValue && 'text-text-tertiary', triggerClassName)}>{!noValue ? item?.label : placeholder}</div> |
| | | {!readonly && <DropDownIcon className='h-3 w-3 ' />} |
| | | className={cn(showOption && 'bg-black/5', 'flex items-center h-5 pl-1 pr-0.5 rounded-md text-xs font-semibold text-gray-700 cursor-pointer hover:bg-black/5')}> |
| | | <div className={cn('text-sm font-semibold', uppercase && 'uppercase', noValue && 'text-gray-400', triggerClassName)}>{!noValue ? item?.label : placeholder}</div> |
| | | {!readonly && <DropDownIcon className='w-3 h-3 ' />} |
| | | </div> |
| | | )} |
| | | |
| | | {(showOption && !readonly) && ( |
| | | <div className={cn('absolute top-[24px] z-10 w-[120px] select-none rounded-lg border border-components-panel-border bg-components-panel-bg p-1 shadow-lg', popupClassName)}> |
| | | <div className={cn('absolute z-10 top-[24px] w-[120px] p-1 border border-gray-200 shadow-lg rounded-lg bg-white select-none', popupClassName)}> |
| | | {list.map(item => ( |
| | | <div |
| | | key={item.value} |
| | |
| | | setHide() |
| | | onChange(item.value) |
| | | }} |
| | | className={cn(itemClassName, uppercase && 'uppercase', 'flex h-[30px] min-w-[44px] cursor-pointer items-center justify-between rounded-lg px-3 text-[13px] font-medium text-text-secondary hover:bg-state-base-hover')} |
| | | className={cn(itemClassName, uppercase && 'uppercase', 'flex items-center h-[30px] justify-between min-w-[44px] px-3 rounded-lg cursor-pointer text-[13px] font-medium text-gray-700 hover:bg-gray-50')} |
| | | > |
| | | <div>{item.label}</div> |
| | | {showChecked && item.value === value && <Check className='h-4 w-4 text-text-primary' />} |
| | | {showChecked && item.value === value && <Check className='text-primary-600 w-4 h-4' />} |
| | | </div> |
| | | )) |
| | | } |