Skip to content

Commit 505852c

Browse files
committed
feat: fluent styles for part grouping
1 parent 4b285bd commit 505852c

3 files changed

Lines changed: 270 additions & 160 deletions

File tree

packages/fluent-theme/src/components/activity/ActivityDecorator.module.css

Lines changed: 0 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -7,82 +7,6 @@
77
padding-block-end: var(--webchat-spacingVerticalXL);
88
}
99

10-
/* Stacked layout */
11-
:global(.webchat-fluent) .activity-decorator :global(.stacked-layout) {
12-
display: flex;
13-
flex-flow: column nowrap;
14-
margin-inline: var(--webchat-spacingHorizontalMNudge);
15-
16-
:global(.stacked-layout__title) {
17-
font-size: var(--webchat-fontSizeBase400);
18-
line-height: var(--webchat-lineHeightBase400);
19-
color: var(--webchat-colorNeutralForeground4);
20-
margin: var(--webchat__bubble--block-padding) var(--webchat__bubble--inline-padding);
21-
}
22-
23-
:global(.stacked-layout__attachment-row) {
24-
margin-block-start: var(--webchat-spacingVerticalMNudge);
25-
}
26-
27-
&:global(.stacked-layout--no-message .stacked-layout__attachment-row) {
28-
margin-block-start: 0;
29-
}
30-
}
31-
32-
/* Stacked layout which has message bubble */
33-
:global(.webchat-fluent) .activity-decorator :global(.stacked-layout .stacked-layout__content:has(.webchat__bubble)) {
34-
max-width: 100%;
35-
overflow: visible;
36-
}
37-
38-
/* Message status */
39-
:global(.webchat-fluent) .activity-decorator :global(.stacked-layout .stacked-layout__status) {
40-
font-size: var(--webchat__font-size--small);
41-
line-height: var(--webchat__line-height--small);
42-
}
43-
44-
/* Message bubble */
45-
:global(.webchat-fluent) .activity-decorator :global(.stacked-layout .webchat__bubble) {
46-
max-width: min(var(--webchat__bubble--max-width), 100%);
47-
min-width: var(--webchat__bubble--min-width);
48-
overflow: visible;
49-
50-
/* Ensure activity loader doesn't have bubble and shadow */
51-
&:has(:global(.activity-loader)) :global(.webchat__bubble__content) {
52-
background: transparent;
53-
box-shadow: none;
54-
}
55-
}
56-
57-
/* Message bubble content */
58-
:global(.webchat-fluent) .activity-decorator :global(.stacked-layout .webchat__bubble .webchat__bubble__content) {
59-
background-color: var(--webchat__bubble--background-color);
60-
border-radius: var(--webchat__bubble--border-radius);
61-
border-width: 0;
62-
box-shadow: var(--webchat__bubble--box-shadow);
63-
box-sizing: border-box;
64-
color: var(--webchat-colorNeutralForeground1);
65-
max-width: 100%;
66-
min-height: var(--webchat__bubble--min-height);
67-
}
68-
69-
/* Message bubble text content */
70-
:global(.webchat-fluent) .activity-decorator :global(.stacked-layout .webchat__bubble .webchat__text-content) {
71-
font-size: var(--webchat__font-size--medium);
72-
line-height: var(--webchat__line-height--medium);
73-
min-height: auto;
74-
padding-block: var(--webchat__bubble--block-padding);
75-
padding-inline: var(--webchat__bubble--inline-padding);
76-
77-
&:empty {
78-
padding-block-end: 0;
79-
}
80-
81-
+ :global(.webchat__text-content) {
82-
margin-top: calc(var(--webchat__bubble--block-padding) * -1);
83-
}
84-
}
85-
8610
/* Message bubble text content generated badge */
8711
:global(.webchat-fluent)
8812
.activity-decorator
@@ -123,66 +47,6 @@
12347
color: var(--webchat-colorBrandForegroundLink);
12448
}
12549

126-
/* Message bubble collapsible content */
127-
:global(.webchat-fluent) .activity-decorator :global(.stacked-layout .webchat__bubble .collapsible-content) {
128-
:global(.collapsible-content__summary) {
129-
margin-block: var(--webchat__bubble--block-padding);
130-
margin-inline: var(--webchat__bubble--inline-padding);
131-
132-
&:focus-visible {
133-
border-radius: var(--webchat-borderRadiusSmall);
134-
outline-offset: 4px;
135-
outline: var(--webchat-strokeWidthThick) solid var(--webchat-colorStrokeFocus2);
136-
}
137-
}
138-
139-
:global(.collapsible-content__content) {
140-
margin-block: 0 var(--webchat__bubble--block-padding);
141-
}
142-
143-
:global(.collapsible-content__content .stacked-layout__attachment-list) {
144-
gap: var(--webchat-spacingVerticalS);
145-
}
146-
147-
:global(.collapsible-content__content .stacked-layout__attachment-row) {
148-
margin: 0;
149-
}
150-
151-
:global(.collapsible-content__content .stacked-layout__attachment-row .webchat__text-content) {
152-
padding-block: 0;
153-
}
154-
}
155-
156-
/* Message bubble code block content */
157-
:global(.webchat-fluent) .activity-decorator :global(.stacked-layout .webchat__bubble .code-block-content) {
158-
border-radius: var(--webchat-borderRadiusXLarge);
159-
border: var(--webchat-strokeWidthThin) solid var(--webchat-colorNeutralStroke1);
160-
font-size: var(--webchat-fontSizeBase300);
161-
font-weight: var(--webchat-fontWeightRegular);
162-
margin-block: 0;
163-
margin-inline: var(--webchat__bubble--inline-padding);
164-
165-
:global(.code-block-content__header) {
166-
padding: var(--webchat-spacingVerticalM) var(--webchat-spacingHorizontalL);
167-
}
168-
169-
:global(.code-block-content__code-block) {
170-
padding-block: var(--webchat-spacingVerticalM);
171-
padding-inline: var(--webchat-spacingHorizontalL) var(--webchat-spacingHorizontalS);
172-
}
173-
174-
:global(.webchat__code-block-copy-button) {
175-
--webchat__code-block__copy-button--color: var(--webchat-colorNeutralForeground1);
176-
--webchat__code-block__copy-button--background: var(--webchat-colorNeutralBackground3);
177-
178-
margin-block-start: var(--webchat-spacingVerticalM);
179-
margin-inline-end: var(--webchat-spacingHorizontalL);
180-
position: absolute;
181-
right: 0;
182-
top: 0;
183-
}
184-
}
185-
18650
/* Markdown links and citation links */
18751
:global(.webchat-fluent)
18852
.activity-decorator

packages/fluent-theme/src/components/activity/PartGroupingDecorator.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,19 @@ function PartGroupingDecorator(props: PartGroupingDecoratorProps) {
2828
[activity, restActivities.length]
2929
);
3030

31+
const isFromUser = activity?.from?.role === 'user';
32+
const isFromBot = activity?.from?.role === 'bot';
33+
3134
const shouldRenderHeader = variants.includes('copilot') && activity?.from?.role === 'bot';
3235

3336
return (
3437
<div
3538
className={cx(
3639
classNames['part-grouping-decorator'],
3740
{
38-
[classNames['part-grouping-decorator--group']]: isInGroup
41+
[classNames['part-grouping-decorator--group']]: isInGroup,
42+
[classNames['part-grouping-decorator--from-user']]: isFromUser,
43+
[classNames['part-grouping-decorator--from-bot']]: isFromBot
3944
},
4045
variantClassName
4146
)}

0 commit comments

Comments
 (0)