From 20ca55e1b23dd9c494cc90ca6337d0824ec48169 Mon Sep 17 00:00:00 2001 From: Ilya Y <75578537+ilya-bkv@users.noreply.github.com> Date: Fri, 12 May 2023 20:50:28 +0300 Subject: [PATCH] Add maxLength counter in Growing Textarea (#95) --- src/components/Views/Edit.tsx | 2 ++ .../GrowingTextarea.module.scss | 31 +++++++++++++++++++ .../GrowingTextarea/GrowingTextarea.tsx | 17 +++++++++- 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/components/Views/Edit.tsx b/src/components/Views/Edit.tsx index 131be0d0..980f058e 100644 --- a/src/components/Views/Edit.tsx +++ b/src/components/Views/Edit.tsx @@ -144,6 +144,7 @@ export const EditView = (props: EditViewProps) => { class={styles.titleInput} placeholder={t('Header')} initialValue={form.title} + maxLength={100} />
{formErrors.title}
@@ -154,6 +155,7 @@ export const EditView = (props: EditViewProps) => { class={styles.subtitleInput} placeholder={t('Subheader')} initialValue={form.subtitle} + maxLength={100} /> void + maxLength?: number } export const GrowingTextarea = (props: Props) => { const [value, setValue] = createSignal('') + const [isFocused, setIsFocused] = createSignal(false) const handleChangeValue = (event) => { setValue(event.target.value) props.value(event.target.value) @@ -31,14 +33,27 @@ export const GrowingTextarea = (props: Props) => {