placeholder.tsx 626 B

123456789101112131415161718192021222324252627
  1. import { memo } from 'react'
  2. import { useTranslation } from 'react-i18next'
  3. import cn from '@/utils/classnames'
  4. const Placeholder = ({
  5. compact,
  6. value,
  7. className,
  8. }: {
  9. compact?: boolean
  10. value?: string
  11. className?: string
  12. }) => {
  13. const { t } = useTranslation()
  14. return (
  15. <div className={cn(
  16. className,
  17. 'pointer-events-none absolute left-0 top-0 h-full w-full select-none text-sm text-components-input-text-placeholder',
  18. compact ? 'text-[13px] leading-5' : 'text-sm leading-6',
  19. )}>
  20. {value || t('common.promptEditor.placeholder')}
  21. </div>
  22. )
  23. }
  24. export default memo(Placeholder)