From 2ae629e2be2ecd6004673020f0195b5939bab729 Mon Sep 17 00:00:00 2001 From: somebodyawesome-dev Date: Wed, 26 Jun 2024 20:03:18 +0100 Subject: [PATCH 1/7] corrected --nlux-ChatRoom--Padding values to match figma --- packages/css/themes/src/dev/layout.css | 2 +- packages/css/themes/src/luna/layout.css | 2 +- packages/css/themes/src/nova/layout.css | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/css/themes/src/dev/layout.css b/packages/css/themes/src/dev/layout.css index d29a36be..6e90d33f 100644 --- a/packages/css/themes/src/dev/layout.css +++ b/packages/css/themes/src/dev/layout.css @@ -33,7 +33,7 @@ --nlux-ChatRoom--FontFamily: 'Merienda', cursive; --nlux-ChatRoom--FontSize: 16px; - --nlux-ChatRoom--Padding: 10px; + --nlux-ChatRoom--Padding: 20px; --nlux-ChatRoom--BorderRadius: 8px; --nlux-ChatRoom--BorderWidth: 5px; diff --git a/packages/css/themes/src/luna/layout.css b/packages/css/themes/src/luna/layout.css index 7eec47a2..5cf95590 100644 --- a/packages/css/themes/src/luna/layout.css +++ b/packages/css/themes/src/luna/layout.css @@ -39,7 +39,7 @@ --nlux-ChatRoom--FontFamily: var(--nlux-luna--FontFamily); --nlux-ChatRoom--FontSize: 16px; - --nlux-ChatRoom--Padding: 10px; + --nlux-ChatRoom--Padding: 20px; --nlux-ChatRoom--BorderRadius: var(--nlux-luna--BorderRadius); --nlux-ChatRoom--BorderWidth: var(--nlux-luna--BorderWidth); diff --git a/packages/css/themes/src/nova/layout.css b/packages/css/themes/src/nova/layout.css index 50d646e0..6fe5efee 100644 --- a/packages/css/themes/src/nova/layout.css +++ b/packages/css/themes/src/nova/layout.css @@ -38,7 +38,7 @@ --nlux-ChatRoom--FontFamily: var(--nlux-nova--FontFamily); --nlux-ChatRoom--FontSize: 16px; - --nlux-ChatRoom--Padding: 10px; + --nlux-ChatRoom--Padding: 20px; --nlux-ChatRoom--BorderRadius: 18px; --nlux-ChatRoom--BorderWidth: var(--nlux-nova--BorderWidth); From d2dca3703bac8f446cf9bce8b245f37ec57f5932 Mon Sep 17 00:00:00 2001 From: somebodyawesome-dev Date: Sun, 30 Jun 2024 17:52:53 +0100 Subject: [PATCH 2/7] update textarea style to support multiple lines --- packages/css/themes/src/common/components/Composer.css | 10 +++++++--- packages/css/themes/src/common/structure.css | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/css/themes/src/common/components/Composer.css b/packages/css/themes/src/common/components/Composer.css index 0ee44ebe..81308aca 100644 --- a/packages/css/themes/src/common/components/Composer.css +++ b/packages/css/themes/src/common/components/Composer.css @@ -1,5 +1,5 @@ .nlux-comp-composer { - height: 100%; + /* height: 100%; */ display: flex; align-items: stretch; flex-direction: row; @@ -8,11 +8,15 @@ gap: var(--nlux-prmBx--gap); > textarea { - height: 100%; + height:100%; + max-height: 80px; /* Set the initial height */ + /* overflow-y: hidden; */ + field-sizing: content; + font-family: var(--nlux-prmInp--ftFm), sans-serif; font-size: var(--nlux-prmInp--ftSz); font-weight: 400; - line-height: 1.3; + line-height: 1; box-sizing: border-box; padding: var(--nlux-chtr--pdng); flex: 1; diff --git a/packages/css/themes/src/common/structure.css b/packages/css/themes/src/common/structure.css index fab73039..109efc81 100644 --- a/packages/css/themes/src/common/structure.css +++ b/packages/css/themes/src/common/structure.css @@ -38,7 +38,7 @@ } > .nlux-composer-container { - height: 60px; + min-height: 60px; width: 100%; display: flex; flex-direction: row; From 19ee7911eafab6a3dcb46f94feea8fca5e25c8ea Mon Sep 17 00:00:00 2001 From: somebodyawesome-dev Date: Sun, 30 Jun 2024 17:53:28 +0100 Subject: [PATCH 3/7] auto adjust textarea height after input change --- .../core/src/sections/Composer/ComposerComp.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/react/core/src/sections/Composer/ComposerComp.tsx b/packages/react/core/src/sections/Composer/ComposerComp.tsx index 0cd635c5..83ea4f70 100644 --- a/packages/react/core/src/sections/Composer/ComposerComp.tsx +++ b/packages/react/core/src/sections/Composer/ComposerComp.tsx @@ -48,6 +48,20 @@ export const ComposerComp = (props: ComposerProps) => { } }, [handleSubmit, props.submitShortcut]); + useEffect(()=>{ + if(!textareaRef.current) return; + const adjustHeight = () => { + const textarea = textareaRef.current; + if (textarea) { + textarea.style.height = 'auto'; // Reset height + textarea.style.height = `${textarea.scrollHeight}px`; // Set new height based on content + } + }; + textareaRef.current.addEventListener('input',adjustHeight); + return ()=>{textareaRef.current?.removeEventListener('input',adjustHeight)} + + },[textareaRef.current]) + return (