From aeb9b9579b637cc9220160789f46e50b91fa5892 Mon Sep 17 00:00:00 2001 From: Giri Madhan <87971509+giri-madhan@users.noreply.github.com> Date: Wed, 19 Apr 2023 22:09:40 +0530 Subject: [PATCH] feat: [#232] Added a bigger UI for Goal input (#242) * feat(#232): added a bigger textarea input for Goal. * fix: added a padding top for goal input on mobile. * feat: added shift+enter should to create new line. * fix: disabled resizing goal input. --- src/components/Input.tsx | 24 ++++++++++++++++++++++-- src/components/Label.tsx | 7 ++++++- src/pages/index.tsx | 10 +++++++--- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/components/Input.tsx b/src/components/Input.tsx index 105d405078..65b14671e6 100644 --- a/src/components/Input.tsx +++ b/src/components/Input.tsx @@ -8,7 +8,7 @@ import type { toolTipProperties } from "./types"; interface InputProps { left?: React.ReactNode; value: string | number; - onChange: (e: React.ChangeEvent) => void; + onChange: (e: React.ChangeEvent | React.ChangeEvent) => void; placeholder?: string; disabled?: boolean; setValue?: (value: string) => void; @@ -16,7 +16,7 @@ interface InputProps { attributes?: { [key: string]: string | number | string[] }; // attributes specific to input type toolTipProperties?: toolTipProperties; inputRef?: React.RefObject; - onKeyDown?: (e: React.KeyboardEvent) => void; + onKeyDown?: (e: React.KeyboardEvent | React.KeyboardEvent) => void; } const Input = (props: InputProps) => { @@ -41,6 +41,10 @@ const Input = (props: InputProps) => { return type === "range"; }; + const isTypeTextArea = () => { + return type === "textarea"; + }; + let inputElement; const options = attributes?.options; @@ -58,6 +62,22 @@ const Input = (props: InputProps) => { onChange={setValue} /> ); + } else if (isTypeTextArea()) { + inputElement = ( +