Make height smaller and allow width to change with node

This commit is contained in:
mickr777 2023-07-21 08:03:01 +10:00 committed by GitHub
parent f73b45bcb5
commit 7b428b5240
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,9 +9,14 @@ import { ChangeEvent, memo } from 'react';
import { FieldComponentProps } from './types'; import { FieldComponentProps } from './types';
const StringInputFieldComponent = ( const StringInputFieldComponent = (
props: FieldComponentProps<StringInputFieldValue, StringInputFieldTemplate> props: FieldComponentProps<
StringInputFieldValue,
StringInputFieldTemplate
> & {
nodeWidth: number;
}
) => { ) => {
const { nodeId, field } = props; const { nodeId, field, nodeWidth } = props;
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const handleValueChanged = (e: ChangeEvent<HTMLTextAreaElement>) => { const handleValueChanged = (e: ChangeEvent<HTMLTextAreaElement>) => {
@ -24,11 +29,13 @@ const StringInputFieldComponent = (
); );
}; };
const textareaWidth = nodeWidth - 20;
return ( return (
<Textarea <Textarea
style={{ style={{
height: '200px', height: '150px',
width: '350px', width: `${textareaWidth}px`,
resize: 'none', resize: 'none',
overflowY: 'auto', overflowY: 'auto',
}} }}