From 74b8cbb22490d23a58524db4ac6d8e89ad0d48e3 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Sun, 11 Jun 2023 10:48:42 -0300 Subject: [PATCH] dropdown float, placeholders and inputlist bug fix --- .../src/components/codeAreaComponent/index.tsx | 2 +- .../src/components/dropdownComponent/index.tsx | 15 ++++++--------- .../src/components/inputListComponent/index.tsx | 7 +++++-- .../src/components/promptComponent/index.tsx | 4 ++-- .../src/components/textAreaComponent/index.tsx | 2 +- src/frontend/src/modals/EditNodeModal/index.tsx | 2 ++ src/frontend/src/types/components/index.ts | 2 ++ 7 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/frontend/src/components/codeAreaComponent/index.tsx b/src/frontend/src/components/codeAreaComponent/index.tsx index 7ba38918b..b1c907998 100644 --- a/src/frontend/src/components/codeAreaComponent/index.tsx +++ b/src/frontend/src/components/codeAreaComponent/index.tsx @@ -40,7 +40,7 @@ export default function CodeAreaComponent({ }} className={ editNode - ? "h-7 truncate placeholder:text-center text-gray-500 border-0 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm sm:text-sm focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200" + ? "h-7 truncate cursor-pointer placeholder:text-center text-gray-500 border-0 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm sm:text-sm focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200" : "truncate block w-full text-gray-500 px-3 py-2 rounded-md border border-gray-300 dark:border-gray-700 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm" + (disabled ? " bg-gray-200" : "") } diff --git a/src/frontend/src/components/dropdownComponent/index.tsx b/src/frontend/src/components/dropdownComponent/index.tsx index 48c41d118..c7479abfb 100644 --- a/src/frontend/src/components/dropdownComponent/index.tsx +++ b/src/frontend/src/components/dropdownComponent/index.tsx @@ -9,6 +9,7 @@ export default function Dropdown({ options, onSelect, editNode = false, + numberOfOptions = 0, }: DropDownComponentType) { let [internalValue, setInternalValue] = useState( value === "" || !value ? "Choose an option" : value @@ -25,16 +26,12 @@ export default function Dropdown({ > {({ open }) => ( <> -
+
{internalValue} @@ -62,8 +59,8 @@ export default function Dropdown({ {options.map((option, id) => ( diff --git a/src/frontend/src/components/inputListComponent/index.tsx b/src/frontend/src/components/inputListComponent/index.tsx index 49b0a1a5a..5f5e1f04e 100644 --- a/src/frontend/src/components/inputListComponent/index.tsx +++ b/src/frontend/src/components/inputListComponent/index.tsx @@ -9,6 +9,7 @@ export default function InputListComponent({ value, onChange, disabled, + editNode = false, }: InputListComponentType) { const [inputList, setInputList] = useState(value ?? [""]); useEffect(() => { @@ -30,8 +31,10 @@ export default function InputListComponent({ type="text" value={i} className={ - "block w-full form-input rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm" + - (disabled ? " bg-gray-200" : "") + editNode + ? "h-7 truncate cursor-pointer text-center placeholder:text-center text-gray-500 border-0 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm sm:text-sm focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200" + : "block w-full form-input rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm" + + (disabled ? " bg-gray-200" : "") } placeholder="Type something..." onChange={(e) => { diff --git a/src/frontend/src/components/promptComponent/index.tsx b/src/frontend/src/components/promptComponent/index.tsx index a1729ef99..bbe9c3bf8 100644 --- a/src/frontend/src/components/promptComponent/index.tsx +++ b/src/frontend/src/components/promptComponent/index.tsx @@ -45,12 +45,12 @@ export default function PromptAreaComponent({ }} className={ editNode - ? "h-7 truncate placeholder:text-center text-gray-500 border-0 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm sm:text-sm focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200" + ? "h-7 cursor-pointer truncate placeholder:text-center text-gray-500 border-0 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm sm:text-sm focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200" : "truncate block w-full text-gray-500 px-3 py-2 rounded-md border border-gray-300 dark:border-gray-700 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm" + (disabled ? " bg-gray-200" : "") } > - {myValue !== "" ? myValue : "-"} + {myValue !== "" ? myValue : "Type your prompt here"}