Faisal Amir ba3c07eba8
feat: textarea auto resize (#3695)
* feat: improve textarea user experience with autoresize

* chore: remove log

* chore: update test

* chore: update test and cleanup logic useEffect
2024-09-19 10:10:30 +07:00

47 lines
976 B
TypeScript

import { TextArea, Tooltip } from '@janhq/joi'
import { InfoIcon } from 'lucide-react'
type Props = {
title: string
disabled?: boolean
name: string
description: string
placeholder: string
value: string
onValueChanged?: (e: string | number | boolean) => void
}
const ModelConfigInput = ({
title,
disabled = false,
value,
description,
placeholder,
onValueChanged,
}: Props) => (
<div className="flex flex-col">
<div className="mb-2 flex items-center gap-x-2">
<p className="font-medium">{title}</p>
<Tooltip
trigger={
<InfoIcon
size={16}
className="flex-shrink-0 text-[hsla(var(--text-secondary))]"
/>
}
content={description}
/>
</div>
<TextArea
placeholder={placeholder}
onChange={(e) => onValueChanged?.(e.target.value)}
autoResize
value={value}
disabled={disabled}
/>
</div>
)
export default ModelConfigInput