ConceptPortal-public/rsconcept/frontend/src/components/Common/TextArea.tsx

46 lines
918 B
TypeScript
Raw Normal View History

import clsx from 'clsx';
2023-08-10 14:13:34 +03:00
import { CProps } from '../props';
2023-07-15 17:46:19 +03:00
import Label from './Label';
2023-08-23 22:57:25 +03:00
export interface TextAreaProps
extends CProps.Editor, CProps.Colors, CProps.TextArea {
2023-10-23 18:22:55 +03:00
dense?: boolean
2023-07-15 17:46:19 +03:00
}
2023-07-20 17:11:03 +03:00
function TextArea({
id, label, required, rows,
2023-11-10 15:34:59 +03:00
dense, noBorder, noOutline,
className,
2023-11-05 16:31:49 +03:00
colors = 'clr-input',
...restProps
2023-07-20 17:11:03 +03:00
}: TextAreaProps) {
2023-07-15 17:46:19 +03:00
return (
<div className={clsx(
{
'flex flex-col gap-2': !dense,
'flex items-center gap-3': dense
},
dense && className,
)}>
<Label text={label} htmlFor={id} />
<textarea id={id}
className={clsx(
'px-3 py-2',
'leading-tight',
{
'border': !noBorder,
'flex-grow': dense,
'clr-outline': !noOutline
},
colors,
!dense && className
)}
rows={rows}
required={required}
{...restProps}
/>
</div>);
2023-07-15 17:46:19 +03:00
}
export default TextArea;