diff --git a/src/components/MultiLineInputBox.res b/src/components/MultiLineInputBox.res deleted file mode 100644 index 166cffabc..000000000 --- a/src/components/MultiLineInputBox.res +++ /dev/null @@ -1,140 +0,0 @@ -@react.component -let make = ( - ~input: ReactFinalForm.fieldRenderPropsInput, - ~placeholder, - ~isDisabled, - ~rows=?, - ~cols=?, - ~customClass="", - ~readOnly=?, - ~maxLength=?, - ~class="", - ~roundedBorder=false, - ~prefix=?, - ~handleRemove=_ => (), - ~setShow=_ => (), -) => { - let (focus, setFocus) = React.useState(_ => false) - let (error, setError) = React.useState(_ => None) - let cursorClass = if isDisabled { - "cursor-not-allowed" - } else { - "" - } - - let handleRemove = _ => { - input.onChange(""->Identity.stringToFormReactEvent) - setError(_ => None) - setFocus(_ => false) - handleRemove() - } - - let className = `rounded-md border border-jp-gray-lightmode_steelgray border-opacity-75 font-normal p-2 text-jp-gray-900 text-opacity-75 placeholder-jp-gray-900 placeholder-opacity-25 hover:bg-jp-gray-lightmode_steelgray hover:bg-opacity-20 hover:border-jp-gray-900 hover:border-opacity-20 focus:text-opacity-100 focus:outline-none focus:border-blue-800 focus:border-opacity-100 dark:text-jp-gray-text_darktheme dark:text-opacity-75 dark:border-jp-gray-960 dark:hover:border-jp-gray-960 dark:hover:bg-jp-gray-970 dark:bg-jp-gray-darkgray_background dark:placeholder-jp-gray-text_darktheme dark:placeholder-opacity-25 dark:focus:text-opacity-100 dark:focus:border-blue-800 ${cursorClass} ${customClass}` - let value = switch input.value->Js.Json.classify { - | JSONString(str) => str - | JSONNumber(num) => num->Belt.Float.toString - | _ => "" - } - - let onBlur = _ => { - let value = value->Js_string.trim - - let lengthError = - maxLength->Belt.Option.flatMap(length => - value->Js_string.length <= length - ? None - : Some(`Maximum length should be ${length->Belt.Int.toString}`) - ) - - let error = lengthError - - if value === "" || error->Belt.Option.isNone { - setFocus(_ => false) - input.onChange(value->Identity.stringToFormReactEvent) - setShow(_ => false) - } else { - setError(_ => error) - setShow(_ => false) - } - } - - let isError = error->Belt.Option.isSome - - let borderColor = isError - ? "border rounded-md border-red-600 dark:border-red-600" - : focus - ? "border-opacity-100 border-blue-800" - : roundedBorder - ? "border-gray-300 dark:border-jp-gray-800" - : "border-opacity-75 border-gray-300 dark:border-jp-gray-800" - - let textAreaComponent = -