Skip to content

Commit bdde3bc

Browse files
authored
Use theme.semanticColors for error text and border of SendBox (#1861)
* using theme.semanticColors.errorText for error border and error message * Removed unnecessary error message styling of text field * Change files * using theme.semanticColors.errorBackground to style background of failed messages * remove unused import * Revert "using theme.semanticColors.errorBackground to style background of failed messages" This reverts commit f961b80.
1 parent 34fee98 commit bdde3bc

8 files changed

Lines changed: 38 additions & 37 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Added error text color in light and dark themes in semanticColors property.",
4+
"packageName": "@internal/react-components",
5+
"email": "79475487+mgamis-msft@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}

packages/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { editBoxStyle, inputBoxIcon, editingButtonStyle, editBoxStyleSet } from
1010
import { InputBoxButton, InputBoxComponent } from '../InputBoxComponent';
1111
import { MessageThreadStrings } from '../MessageThread';
1212
import { borderAndBoxShadowStyle } from '../styles/SendBox.styles';
13-
import { isDarkThemed } from '../../theming/themeUtils';
1413
import { ChatMessage } from '../../types';
1514
/* @conditional-compile-remove(file-sharing) */
1615
import { _FileUploadCards } from '../FileUploadCards';
@@ -103,7 +102,6 @@ export const ChatMessageComponentAsEditBox = (props: ChatMessageComponentAsEditB
103102
className={mergeStyles(
104103
borderAndBoxShadowStyle({
105104
theme,
106-
errorColor: isDarkThemed(theme) ? '#f1707b' : '#a80000',
107105
hasErrorMessage: false,
108106
disabled: false
109107
})

packages/react-components/src/components/InputBoxComponent.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ export const InputBoxComponent = (props: InputBoxComponentProps): JSX.Element =>
8787
children
8888
} = props;
8989

90-
const theme = useTheme();
9190
const mergedRootStyle = mergeStyles(inputBoxWrapperStyle, styles?.root);
9291
const mergedTextFiledStyle = mergeStyles(
9392
inputBoxStyle,
@@ -96,7 +95,7 @@ export const InputBoxComponent = (props: InputBoxComponentProps): JSX.Element =>
9695
);
9796

9897
const mergedTextContainerStyle = mergeStyles(textContainerStyle, styles?.textFieldContainer);
99-
const mergedTextFieldStyle = concatStyleSets(textFieldStyle(isDarkThemed(theme) ? '#f1707b' : '#a80000'), {
98+
const mergedTextFieldStyle = concatStyleSets(textFieldStyle, {
10099
fieldGroup: styles?.textField,
101100
errorMessage: styles?.systemMessage
102101
});

packages/react-components/src/components/SendBox.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { useLocale } from '../localization';
1616
import { useIdentifiers } from '../identifiers';
1717
import { InputBoxButton, InputBoxComponent } from './InputBoxComponent';
1818

19-
import { isDarkThemed } from '../theming/themeUtils';
2019
/* @conditional-compile-remove(file-sharing) */
2120
import { SendBoxErrors } from './SendBoxErrors';
2221
/* @conditional-compile-remove(file-sharing) */
@@ -332,7 +331,6 @@ export const SendBox = (props: SendBoxProps): JSX.Element => {
332331
className={mergeStyles(
333332
borderAndBoxShadowStyle({
334333
theme,
335-
errorColor: isDarkThemed(theme) ? '#f1707b' : '#a80000',
336334
hasErrorMessage: !!errorMessage,
337335
disabled: !!disabled
338336
})

packages/react-components/src/components/styles/ChatMessageComponent.styles.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
IIconStyles
1212
} from '@fluentui/react';
1313
import { _pxToRem } from '@internal/acs-ui-common';
14-
import { isDarkThemed } from '../../theming/themeUtils';
1514

1615
const MINIMUM_TOUCH_TARGET_HEIGHT_REM = 3;
1716

@@ -65,7 +64,7 @@ export const chatMessageEditedTagStyle = (theme: Theme): string =>
6564
* @private
6665
*/
6766
export const chatMessageFailedTagStyle = (theme: Theme): string =>
68-
mergeStyles({ fontWeight: FontWeights.light, color: isDarkThemed(theme) ? '#f1707b' : '#a80000' });
67+
mergeStyles({ fontWeight: FontWeights.light, color: theme.semanticColors.errorText });
6968

7069
/**
7170
* @private

packages/react-components/src/components/styles/InputBoxComponent.style.ts

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -53,31 +53,26 @@ export const textContainerStyle: IStyle = {
5353
/**
5454
* @private
5555
*/
56-
export const textFieldStyle = (errorColor: string): IStyle => {
57-
return {
58-
root: {
59-
width: '100%',
60-
minHeight: '0',
61-
fontSize: '8.25rem'
62-
},
63-
wrapper: {},
64-
fieldGroup: {
65-
outline: 'none',
66-
border: 'none',
67-
height: 'auto',
68-
minHeight: '0',
69-
/**
70-
* Removing fieldGroup border to make sure no border is rendered around the text area in sendbox.
71-
*/
72-
':after': { border: 'none' }
73-
},
74-
field: {
75-
borderRadius: '0.25rem'
76-
},
77-
errorMessage: {
78-
color: errorColor
79-
}
80-
};
56+
export const textFieldStyle: IStyle = {
57+
root: {
58+
width: '100%',
59+
minHeight: '0',
60+
fontSize: '8.25rem'
61+
},
62+
wrapper: {},
63+
fieldGroup: {
64+
outline: 'none',
65+
border: 'none',
66+
height: 'auto',
67+
minHeight: '0',
68+
/**
69+
* Removing fieldGroup border to make sure no border is rendered around the text area in sendbox.
70+
*/
71+
':after': { border: 'none' }
72+
},
73+
field: {
74+
borderRadius: '0.25rem'
75+
}
8176
};
8277

8378
/**

packages/react-components/src/components/styles/SendBox.styles.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,12 @@ const defaultSendBoxActiveBorderThicknessREM = 0.125;
6666
*/
6767
export const borderAndBoxShadowStyle = (props: {
6868
theme: Theme;
69-
errorColor: string;
7069
hasErrorMessage: boolean;
7170
disabled: boolean;
7271
}): IStyle => {
73-
const { theme, errorColor, hasErrorMessage, disabled } = props;
74-
const borderColor = hasErrorMessage ? errorColor : theme.palette.neutralSecondary;
75-
const borderColorActive = hasErrorMessage ? errorColor : theme.palette.themePrimary;
72+
const { theme, hasErrorMessage, disabled } = props;
73+
const borderColor = hasErrorMessage ? theme.semanticColors.errorText : theme.palette.neutralSecondary;
74+
const borderColorActive = hasErrorMessage ? theme.semanticColors.errorText : theme.palette.themePrimary;
7675

7776
const borderThickness = disabled ? 0 : defaultSendBoxInactiveBorderThicknessREM;
7877
const borderActiveThickness = disabled ? 0 : defaultSendBoxActiveBorderThicknessREM;

packages/react-components/src/theming/themes.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ export const lightTheme: PartialTheme & CallingTheme = {
5252
callRedDark: '#8b2c3d',
5353
callRedDarker: '#772a38',
5454
iconWhite: '#ffffff'
55+
},
56+
semanticColors: {
57+
errorText: '#a80000'
5558
}
5659
};
5760

@@ -90,5 +93,8 @@ export const darkTheme: PartialTheme & CallingTheme = {
9093
callRedDark: '#a42e43',
9194
callRedDarker: '#8b2c3d',
9295
iconWhite: '#ffffff'
96+
},
97+
semanticColors: {
98+
errorText: '#f1707b'
9399
}
94100
};

0 commit comments

Comments
 (0)