placeholder.tsx 601 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. 'absolute top-0 left-0 h-full w-full text-sm text-gray-300 select-none pointer-events-none',
  18. compact ? 'leading-5 text-[13px]' : 'leading-6 text-sm',
  19. )}>
  20. {value || t('common.promptEditor.placeholder')}
  21. </div>
  22. )
  23. }
  24. export default memo(Placeholder)