Only apply Textaera to Prompt

This commit is contained in:
mickr777 2023-07-21 13:17:27 +10:00 committed by GitHub
parent 98b2734240
commit 585520d8d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
import { Textarea } from '@chakra-ui/react';
import { Textarea, Input } from '@chakra-ui/react';
import { useAppDispatch } from 'app/store/storeHooks';
import { fieldValueChanged } from 'features/nodes/store/nodesSlice';
import {
@ -19,7 +19,9 @@ const StringInputFieldComponent = (
const { nodeId, field, nodeWidth } = props;
const dispatch = useAppDispatch();
const handleValueChanged = (e: ChangeEvent<HTMLTextAreaElement>) => {
const handleValueChanged = (
e: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>
) => {
dispatch(
fieldValueChanged({
nodeId,
@ -32,16 +34,26 @@ const StringInputFieldComponent = (
const textareaWidth = nodeWidth - 20;
return (
<Textarea
style={{
height: '150px',
width: `${textareaWidth}px`,
resize: 'none',
overflowY: 'auto',
}}
onChange={handleValueChanged}
value={field.value}
/>
<>
{field.name.toLowerCase() === 'prompt' ? (
<Textarea
style={{
height: '150px',
width: `${textareaWidth}px`,
resize: 'none',
overflowY: 'auto',
}}
onChange={handleValueChanged}
value={field.value}
/>
) : (
<Input
style={{ width: `${textareaWidth}px` }}
onChange={handleValueChanged}
value={field.value}
/>
)}
</>
);
};