From ecde2d8c9935581c3cc3dacf8c6255902e7f1b26 Mon Sep 17 00:00:00 2001 From: ilya-bkv Date: Wed, 16 Nov 2022 07:56:15 +0300 Subject: [PATCH] Textarea autoresize --- src/components/Inbox/DialogCard.tsx | 2 +- src/components/Views/Inbox.tsx | 28 ++++++--- src/styles/Inbox.scss | 94 ++++++++++++++++++++--------- src/utils/config.ts | 1 + 4 files changed, 85 insertions(+), 40 deletions(-) diff --git a/src/components/Inbox/DialogCard.tsx b/src/components/Inbox/DialogCard.tsx index c1e11bde..d5708445 100644 --- a/src/components/Inbox/DialogCard.tsx +++ b/src/components/Inbox/DialogCard.tsx @@ -1,8 +1,8 @@ import './DialogCard.module.scss' -import styles from './DialogCard.module.scss' import DialogAvatar from './DialogAvatar' import type { Author } from '../../graphql/types.gen' import { apiClient } from '../../utils/apiClient' +import styles from './DialogCard.module.scss' type Props = { online?: boolean diff --git a/src/components/Views/Inbox.tsx b/src/components/Views/Inbox.tsx index 1dc0e04c..2a9c6706 100644 --- a/src/components/Views/Inbox.tsx +++ b/src/components/Views/Inbox.tsx @@ -121,9 +121,14 @@ export const InboxView = () => { console.error('[post message error]:', error) } } + + let formParent // autoresize ghost element const handleChangeMessage = (event) => { setPostMessageText(event.target.value) } + createEffect(() => { + formParent.dataset.replicatedValue = postMessageText() + }) return (
@@ -197,15 +202,20 @@ export const InboxView = () => {
-
-