input-has-set-multiple-value.tsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. 'use client'
  2. import { RiCloseLine } from '@remixicon/react'
  3. import type { FC } from 'react'
  4. import React from 'react'
  5. import { useTranslation } from 'react-i18next'
  6. import cn from '@/utils/classnames'
  7. type Props = {
  8. onClear: () => void
  9. readOnly?: boolean
  10. }
  11. const InputHasSetMultipleValue: FC<Props> = ({
  12. onClear,
  13. readOnly,
  14. }) => {
  15. const { t } = useTranslation()
  16. return (
  17. <div className='h-6 grow rounded-md bg-components-input-bg-normal p-0.5 text-[0]'>
  18. <div className={cn('inline-flex h-5 items-center space-x-0.5 rounded-[5px] border-[0.5px] border-components-panel-border bg-components-badge-white-to-dark pl-1.5 pr-0.5 shadow-xs', readOnly && 'pr-1.5')}>
  19. <div className='system-xs-regular text-text-secondary'>{t('dataset.metadata.batchEditMetadata.multipleValue')}</div>
  20. {!readOnly && (
  21. <div className='cursor-pointer rounded-[4px] p-px text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary'>
  22. <RiCloseLine
  23. className='size-3.5 '
  24. onClick={onClear}
  25. />
  26. </div>
  27. )}
  28. </div>
  29. </div>
  30. )
  31. }
  32. export default React.memo(InputHasSetMultipleValue)