Skip to content

Commit ca55dc8

Browse files
Hirselayershifter
andauthored
Ensure wide content fits in compact ChatMessage (#18871)
* Ensure wide content fits in compact ChatMessage * Add changelog entry Co-authored-by: Oleksandr Fediashov <olfedias@microsoft.com>
1 parent b77307b commit ca55dc8

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

packages/fluentui/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
2525
- Fix compact hover background in dark themes @Hirse ([#18842](https://github.com/microsoft/fluentui/pull/18842))
2626
- Fix children conflict with compactBody in `ChatMessage` @chassunc ([#18874](https://github.com/microsoft/fluentui/pull/18874))
2727
- Fix `Tooltip` trigger order of props being spread @chassunc ([#18875](https://github.com/microsoft/fluentui/pull/18875))
28+
- Ensure wide content fits in compact ChatMessage @Hirse ([#18871](https://github.com/microsoft/fluentui/pull/18871))
2829

2930
### Features
3031
- Add Onyx 600, Silver 100 to color palette and some color tokens @codepretty ([#18827](https://github.com/microsoft/fluentui/pull/18827))

packages/fluentui/react-northstar-prototypes/src/prototypes/compactChat/CompactChatWithAuthor.tsx

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22

3-
import { Avatar, Chat, ChatItemProps, Flex, Provider, ShorthandCollection } from '@fluentui/react-northstar';
3+
import { Avatar, Box, Chat, ChatItemProps, Provider, ShorthandCollection, Text } from '@fluentui/react-northstar';
44

55
import { robinAvatar, timAvatar } from './compactAvatars';
66

@@ -39,8 +39,15 @@ const items: ShorthandCollection<ChatItemProps> = [
3939
<Chat.Message
4040
content={
4141
<>
42-
<Flex variables={{ messageBox: true }}>Replying to Tim</Flex>
43-
{'Message with non-text content has box elements on the line below author'}
42+
<Box variables={{ quotedReply: true }}>
43+
Replying to:
44+
<Text truncated>
45+
Long message wrapping around the author. The quick brown fox jumps over the lazy dog. Portez ce vieux
46+
whisky au juge blond qui fume. Franz jagt im komplett verwahrlosten Taxi quer durch Bayern. Nechť již
47+
hříšné saxofony ďáblů rozezvučí síň úděsnými tóny waltzu, tanga a quickstepu.
48+
</Text>
49+
</Box>
50+
Message with non-text content has box elements on the line below author
4451
</>
4552
}
4653
author="Robin"
@@ -56,19 +63,23 @@ export const CompactChatWithAuthor = () => (
5663
<Provider
5764
theme={{
5865
componentStyles: {
59-
Flex: {
66+
Box: {
6067
root: ({ variables: v, theme: { siteVariables } }) => ({
61-
...(v.messageBox && {
68+
...(v.quotedReply && {
6269
backgroundColor: siteVariables.colorScheme.default.background1,
63-
border: `solid 1px ${siteVariables.colorScheme.default.border1}`,
64-
borderRadius: '4px',
70+
border: `solid ${siteVariables.borderWidth} ${siteVariables.colorScheme.default.border1}`,
71+
borderRadius: siteVariables.borderRadiusMedium,
6572
boxShadow: siteVariables.shadowLevel1,
6673
clear: 'left',
6774
padding: '0.3rem',
68-
width: 'fit-content',
6975
}),
7076
}),
7177
},
78+
Text: {
79+
root: ({ props: p }) => ({
80+
...(p.truncated && { display: 'block' }),
81+
}),
82+
},
7283
},
7384
}}
7485
>

packages/fluentui/react-northstar/src/themes/teams/components/Chat/chatMessageStylesCompact.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ export const chatMessageStylesCompact: ComponentSlotStylesPrepared<ChatMessageSt
5858
compactBody: (): ICSSInJSStyle => ({
5959
display: 'flex',
6060
justifyContent: 'space-between',
61+
'& > div': {
62+
minWidth: 0,
63+
},
6164
}),
6265

6366
reactionGroup: (): ICSSInJSStyle => ({

0 commit comments

Comments
 (0)