From 8f8cb84d9cb5c40bd79525c0836f231ba058ac4d Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 17 Aug 2022 12:04:58 +0300 Subject: [PATCH] Web:Common:Fix TextareaTheme, InputBlockTheme, TextInputTheme, ComboButtonTheme. --- .../ColorTheme/styled/comboButton.js | 14 +++++++----- .../ColorTheme/styled/inputBlock.js | 18 ++++++++------- .../components/ColorTheme/styled/textInput.js | 22 ++++++++++--------- .../components/ColorTheme/styled/textarea.js | 20 +++++++++-------- 4 files changed, 41 insertions(+), 33 deletions(-) diff --git a/packages/common/components/ColorTheme/styled/comboButton.js b/packages/common/components/ColorTheme/styled/comboButton.js index b6b0ba32ad..f4a5ec0317 100644 --- a/packages/common/components/ColorTheme/styled/comboButton.js +++ b/packages/common/components/ColorTheme/styled/comboButton.js @@ -2,12 +2,14 @@ import styled, { css } from "styled-components"; import { StyledComboButton } from "@docspace/components/combobox/sub-components/styled-combobutton"; import Base from "@docspace/components/themes/base"; -const getDefaultStyles = ({ currentColorScheme, isOpen, theme }) => css` - border-color: ${isOpen && - (theme.isBase === true - ? currentColorScheme.accentColor - : theme.comboBox.button.openBorderColor)}; -`; +const getDefaultStyles = ({ currentColorScheme, isOpen, theme }) => + currentColorScheme && + css` + border-color: ${isOpen && + (theme.isBase + ? currentColorScheme.accentColor + : theme.comboBox.button.openBorderColor)}; + `; StyledComboButton.defaultProps = { theme: Base }; diff --git a/packages/common/components/ColorTheme/styled/inputBlock.js b/packages/common/components/ColorTheme/styled/inputBlock.js index 47707b1dd7..b9ba6b7fbd 100644 --- a/packages/common/components/ColorTheme/styled/inputBlock.js +++ b/packages/common/components/ColorTheme/styled/inputBlock.js @@ -3,14 +3,16 @@ import styled, { css } from "styled-components"; import { StyledInputGroup } from "@docspace/components/input-block/styled-input-block"; import Base from "@docspace/components/themes/base"; -const getDefaultStyles = ({ currentColorScheme, hasError, theme }) => css` - :focus-within { - border-color: ${(hasError && theme.input.focusErrorBorderColor) || - (theme.isBase === true - ? currentColorScheme.accentColor - : theme.inputBlock.borderColor)}; - } -`; +const getDefaultStyles = ({ currentColorScheme, hasError, theme }) => + currentColorScheme && + css` + :focus-within { + border-color: ${(hasError && theme.input.focusErrorBorderColor) || + (theme.isBase + ? currentColorScheme.accentColor + : theme.inputBlock.borderColor)}; + } + `; StyledInputGroup.defaultProps = { theme: Base, diff --git a/packages/common/components/ColorTheme/styled/textInput.js b/packages/common/components/ColorTheme/styled/textInput.js index b3d8ac17de..1c53c3dd41 100644 --- a/packages/common/components/ColorTheme/styled/textInput.js +++ b/packages/common/components/ColorTheme/styled/textInput.js @@ -8,16 +8,18 @@ const getDefaultStyles = ({ hasWarning, isDisabled, theme, -}) => css` - :focus { - border-color: ${(hasError && theme.input.focusErrorBorderColor) || - (hasWarning && theme.input.focusWarningBorderColor) || - (isDisabled && theme.input.focusDisabledBorderColor) || - (theme.isBase === true - ? currentColorScheme.accentColor - : theme.input.focusBorderColor)}; - } -`; +}) => + currentColorScheme && + css` + :focus { + border-color: ${(hasError && theme.input.focusErrorBorderColor) || + (hasWarning && theme.input.focusWarningBorderColor) || + (isDisabled && theme.input.focusDisabledBorderColor) || + (theme.isBase + ? currentColorScheme.accentColor + : theme.input.focusBorderColor)}; + } + `; StyledTextInput.defaultProps = { theme: Base }; diff --git a/packages/common/components/ColorTheme/styled/textarea.js b/packages/common/components/ColorTheme/styled/textarea.js index 64e498f54c..f823d09c6c 100644 --- a/packages/common/components/ColorTheme/styled/textarea.js +++ b/packages/common/components/ColorTheme/styled/textarea.js @@ -2,15 +2,17 @@ import styled, { css } from "styled-components"; import { StyledScrollbar } from "@docspace/components/textarea/styled-textarea"; import Base from "@docspace/components/themes/base"; -const getDefaultStyles = ({ currentColorScheme, hasError, theme }) => css` - :focus-within { - border-color: ${hasError - ? theme.textArea.focusErrorBorderColor - : theme.isBase === true - ? currentColorScheme.accentColor - : theme.textArea.focusBorderColor}; - } -`; +const getDefaultStyles = ({ currentColorScheme, hasError, theme }) => + currentColorScheme && + css` + :focus-within { + border-color: ${hasError + ? theme.textArea.focusErrorBorderColor + : theme.isBase + ? currentColorScheme.accentColor + : theme.textArea.focusBorderColor}; + } + `; StyledScrollbar.defaultProps = { theme: Base,