From 63f560151a35a3a51532343aff30c3fde0c2e6e8 Mon Sep 17 00:00:00 2001 From: Ramir Mesquita Date: Tue, 3 Sep 2024 18:00:14 -0300 Subject: [PATCH] comment addressing --- src/entities/activity/ui/items/TextItem.tsx | 6 ++++-- src/shared/ui/Items/Text/index.tsx | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/entities/activity/ui/items/TextItem.tsx b/src/entities/activity/ui/items/TextItem.tsx index a9385b6d5..046875c17 100644 --- a/src/entities/activity/ui/items/TextItem.tsx +++ b/src/entities/activity/ui/items/TextItem.tsx @@ -17,7 +17,9 @@ type TextItemProps = { export const TextItem = ({ item, value, onValueChange, isDisabled }: TextItemProps) => { const { maxResponseLength } = item.config; - const [hasError, setHasError] = useState(false); + const [hasError, setHasError] = useState( + maxResponseLength > 0 && value.length > maxResponseLength, + ); const numCharacters = value?.length || 0; @@ -51,7 +53,7 @@ export const TextItem = ({ item, value, onValueChange, isDisabled }: TextItemPro color={hasError ? `${Theme.colors.light.error}` : Theme.colors.light.outline} mr={2} > - {`${t('charactersCount', { numCharacters, maxCharacters: maxResponseLength })}`} + {t('charactersCount', { numCharacters, maxCharacters: maxResponseLength })} ); diff --git a/src/shared/ui/Items/Text/index.tsx b/src/shared/ui/Items/Text/index.tsx index 35317ca10..fe08cf077 100644 --- a/src/shared/ui/Items/Text/index.tsx +++ b/src/shared/ui/Items/Text/index.tsx @@ -35,13 +35,14 @@ export const TextItem = ({ value = '', onValueChange, disabled, isMultiline, has }, }, '& .MuiInputBase-root': { - paddingRight: '2px', // Reduce padding inside the input + height: '350px', + paddingRight: '2px', ...(hasError ? { border: `2px solid ${Theme.colors.light.error}` } : {}), borderWidth: '2px', - borderRadius: '20px', + borderRadius: '12px', }, '& .MuiOutlinedInput-notchedOutline': { - border: hasError ? 'none' : `2px solid ${Theme.colors.light.outline}`, + border: hasError ? 'none' : `2px solid ${Theme.colors.light.surfaceVariant}`, }, } : null