2024-04-08 18:51:46 +08:00
|
|
|
import { memo } from 'react'
|
2023-10-12 23:14:28 +08:00
|
|
|
import { useTranslation } from 'react-i18next'
|
2024-07-09 15:05:40 +08:00
|
|
|
import cn from '@/utils/classnames'
|
2023-10-12 23:14:28 +08:00
|
|
|
|
2024-04-08 18:51:46 +08:00
|
|
|
const Placeholder = ({
|
|
|
|
compact,
|
|
|
|
value,
|
|
|
|
className,
|
|
|
|
}: {
|
|
|
|
compact?: boolean
|
|
|
|
value?: string
|
|
|
|
className?: string
|
|
|
|
}) => {
|
2023-10-12 23:14:28 +08:00
|
|
|
const { t } = useTranslation()
|
|
|
|
|
|
|
|
return (
|
2024-04-08 18:51:46 +08:00
|
|
|
<div className={cn(
|
|
|
|
className,
|
2025-01-23 16:20:00 +08:00
|
|
|
'absolute top-0 left-0 h-full w-full text-sm text-components-input-text-placeholder select-none pointer-events-none',
|
2024-04-08 18:51:46 +08:00
|
|
|
compact ? 'leading-5 text-[13px]' : 'leading-6 text-sm',
|
|
|
|
)}>
|
|
|
|
{value || t('common.promptEditor.placeholder')}
|
2023-10-12 23:14:28 +08:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2024-04-08 18:51:46 +08:00
|
|
|
export default memo(Placeholder)
|