Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit 7830f6a

Browse files
authored
fix(Chat): update ChatMessage styles in Teams themes (#1246)
* fix propTypes and warnings * fix styles * fix other themes * add changelog entry * update colors * move changelog entry * update ch entry
1 parent 417078e commit 7830f6a

File tree

9 files changed

+30
-10
lines changed

9 files changed

+30
-10
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
1717

1818
## [Unreleased]
1919

20+
### Fixes
21+
- Update `ChatMessage` styles in Teams themes @layershifter ([#1246](https://github.com/stardust-ui/react/pull/1246))
22+
2023
<!--------------------------------[ v0.29.0 ]------------------------------- -->
2124
## [v0.29.0](https://github.com/stardust-ui/react/tree/v0.29.0) (2019-04-24)
2225
[Compare changes](https://github.com/stardust-ui/react/compare/v0.28.1...v0.29.0)

docs/src/examples/components/Chat/Content/ChatExampleReactionGroup.shorthand.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { Avatar, Chat } from '@stardust-ui/react'
22
import * as React from 'react'
33

4-
const reactions = [{ icon: 'thumbs up', content: '1K' }, { icon: 'thumbs down', content: 5 }]
4+
const reactions = [
5+
{ key: 'up', icon: 'thumbs up', content: '1K' },
6+
{ key: 'down', icon: 'thumbs down', content: 5 },
7+
]
58

69
const items = [
710
{
@@ -27,7 +30,7 @@ const items = [
2730
message: {
2831
content: (
2932
<Chat.Message
30-
reactionGroup={[{ icon: 'thumbs up', content: '8' }]}
33+
reactionGroup={[{ key: 'up', icon: 'thumbs up', content: '8' }]}
3134
content="I'm back!"
3235
author="John Doe"
3336
timestamp="Yesterday, 10:15 PM"

docs/src/examples/components/Chat/Content/ChatExampleReactionGroupMeReacting.shorthand.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ const items = [
3333
message: {
3434
content: (
3535
<Chat.Message
36-
reactionGroup={{ items: reactions }}
37-
reactionGroupPosition={'end'}
36+
reactionGroup={reactions}
37+
reactionGroupPosition="end"
3838
content="I'm back!"
3939
author="John Doe"
4040
timestamp="Yesterday, 10:15 PM"
@@ -50,9 +50,7 @@ const items = [
5050
message: {
5151
content: (
5252
<Chat.Message
53-
reactionGroup={{
54-
items: reactions,
55-
}}
53+
reactionGroup={reactions}
5654
content="Hi"
5755
author="Jane Doe"
5856
timestamp="Yesterday, 10:15 PM"

docs/src/examples/components/Chat/Types/ChatMessageExampleStyled.shorthand.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import * as React from 'react'
22
import { Avatar, Chat, Provider } from '@stardust-ui/react'
33

4-
const reactions = [{ icon: 'thumbs up', content: '1K' }, { icon: 'thumbs down', content: 5 }]
4+
const reactions = [
5+
{ key: 'up', icon: 'thumbs up', content: '1K' },
6+
{ key: 'down', icon: 'thumbs down', content: 5 },
7+
]
58

69
const janeAvatar = {
710
image: 'public/images/avatar/small/ade.jpg',

packages/react/src/components/Chat/ChatMessage.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ class ChatMessage extends UIComponent<ReactProps<ChatMessageProps>, ChatMessageS
121121
timestamp: customPropTypes.itemShorthand,
122122
onBlur: PropTypes.func,
123123
onFocus: PropTypes.func,
124-
reactionGroup: customPropTypes.itemShorthand,
124+
reactionGroup: PropTypes.oneOfType([
125+
customPropTypes.collectionShorthand,
126+
customPropTypes.itemShorthand,
127+
]),
125128
reactionGroupPosition: PropTypes.oneOf(['start', 'end']),
126129
}
127130

packages/react/src/themes/teams-dark/components/Chat/chatMessageVariables.ts

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ export default (siteVars: any): Partial<ChatMessageVariables> => {
44
return {
55
backgroundColor: siteVars.gray10,
66
backgroundColorMine: '#3B3C54',
7+
authorColor: siteVars.gray02, // will be gray[250] with new palette
8+
contentColor: siteVars.colors.white,
79
color: siteVars.colors.white,
810
contentFocusOutlineColor: siteVars.brand,
911
hasMentionNubbinColor: siteVars.naturalColors.orange[900], // orange[300] when the new palette pr is checked in

packages/react/src/themes/teams-high-contrast/components/Chat/chatMessageVariables.ts

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ export default (siteVars: any): Partial<ChatMessageVariables> => {
44
return {
55
backgroundColor: siteVars.black,
66
backgroundColorMine: siteVars.black,
7+
authorColor: siteVars.white,
8+
contentColor: siteVars.white,
79
color: siteVars.white,
810
contentFocusOutlineColor: siteVars.colors.yellow[900], // Red flag (should this be accessibleYellow?)
911
border: `1px solid ${siteVars.white}`,

packages/react/src/themes/teams/components/Chat/chatMessageStyles.ts

+2
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ const chatMessageStyles: ComponentSlotStylesInput<
9393

9494
author: ({ props: p, variables: v }): ICSSInJSStyle => ({
9595
...((p.mine || p.attached === 'bottom' || p.attached === true) && screenReaderContainerStyles),
96+
color: v.authorColor,
9697
marginRight: v.authorMarginRight,
9798
marginBottom: v.headerMarginBottom,
9899
fontWeight: v.authorFontWeight,
@@ -109,6 +110,7 @@ const chatMessageStyles: ComponentSlotStylesInput<
109110
}),
110111

111112
content: ({ props: p, variables: v }): ICSSInJSStyle => ({
113+
color: v.contentColor,
112114
display: 'block',
113115
'& a:focus': {
114116
outline: 'none',

packages/react/src/themes/teams/components/Chat/chatMessageVariables.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ export interface ChatMessageVariables {
1111
offset: string
1212
padding: string
1313
authorMarginRight: string
14+
authorColor: string
1415
authorFontWeight: number
1516
headerMarginBottom: string
17+
contentColor: string
1618
contentFocusOutlineColor: string
1719
border: string
1820
badgeShadow: string
@@ -37,8 +39,10 @@ export default (siteVars): ChatMessageVariables => ({
3739
offset: pxToRem(100),
3840
padding: pxToRem(16),
3941
authorMarginRight: pxToRem(12),
40-
authorFontWeight: siteVars.fontWeightBold,
42+
authorColor: siteVars.gray02, // will be gray[500] with new palette
43+
authorFontWeight: siteVars.fontWeightRegular,
4144
headerMarginBottom: pxToRem(2),
45+
contentColor: '#252423', // will be gray[750] with new palette
4246
contentFocusOutlineColor: siteVars.colors.primary[500],
4347
border: 'none',
4448
badgeShadow: siteVars.shadowLevel1Darker,

0 commit comments

Comments
 (0)