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
|
2025-05-13 16:01:58 +08:00
|
|
|
value?: string | JSX.Element
|
2024-04-08 18:51:46 +08:00
|
|
|
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(
|
2025-03-21 17:41:03 +08:00
|
|
|
'pointer-events-none absolute left-0 top-0 h-full w-full select-none text-sm text-components-input-text-placeholder',
|
|
|
|
compact ? 'text-[13px] leading-5' : 'text-sm leading-6',
|
2025-05-13 16:01:58 +08:00
|
|
|
className,
|
2024-04-08 18:51:46 +08:00
|
|
|
)}>
|
|
|
|
{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)
|