Skip to content

Commit e900501

Browse files
committed
add dark
1 parent b3eb896 commit e900501

9 files changed

+172
-4
lines changed
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
<!doctype html>
2+
<html lang="en-US">
3+
<head>
4+
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
5+
<script crossorigin="anonymous" src="https://unpkg.com/@babel/standalone@7.8.7/babel.min.js"></script>
6+
<script crossorigin="anonymous" src="/test-harness.js"></script>
7+
<script crossorigin="anonymous" src="/test-page-object.js"></script>
8+
<script crossorigin="anonymous" src="/__dist__/fluent-bundle.production.min.js"></script>
9+
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
10+
<script crossorigin="anonymous" src="/__dist__/botframework-webchat-fluent-theme.production.min.js"></script>
11+
<style type="text/css">
12+
.fluent-provider {
13+
height: 100%;
14+
}
15+
</style>
16+
</head>
17+
18+
<body>
19+
<main id="webchat"></main>
20+
<script type="text/babel">
21+
run(async function () {
22+
const {
23+
Fluent: { FluentProvider, createDarkTheme },
24+
React,
25+
ReactDOMClient: { createRoot },
26+
WebChat: { FluentThemeProvider, ReactWebChat }
27+
} = window; // Imports in UMD fashion.
28+
29+
const { directLine, store } = testHelpers.createDirectLineEmulator();
30+
31+
await host.sendDevToolsCommand('Emulation.setEmulatedMedia', {
32+
features: [
33+
{ name: 'prefers-reduced-motion', value: 'reduce' },
34+
{ name: 'prefers-color-scheme', value: 'dark' }
35+
]
36+
});
37+
38+
const root = createRoot(document.getElementById('webchat'));
39+
40+
function renderWebChat(uiState) {
41+
const theme = {
42+
...createDarkTheme({
43+
10: '#12174c',
44+
20: '#1a1f5b',
45+
30: '#21276a',
46+
40: '#293079',
47+
50: '#303788',
48+
60: '#384097',
49+
70: '#4049a7',
50+
80: '#151e80',
51+
90: '#4f59c5',
52+
100: '#5661d4',
53+
110: '#5e69e3',
54+
120: '#7982e8',
55+
130: '#949bec',
56+
140: '#afb5f1',
57+
150: '#c9cdf6',
58+
160: '#e4e6fa'
59+
}),
60+
colorNeutralBackground1Disabled: '#101010',
61+
colorNeutralBackground1Hover: '#101010',
62+
colorNeutralForeground5: '#424242'
63+
};
64+
65+
root.render(
66+
<FluentProvider className="fluent-provider" theme={theme}>
67+
<FluentThemeProvider variant="fluent">
68+
<ReactWebChat directLine={directLine} store={store} uiState={uiState} />
69+
</FluentThemeProvider>
70+
</FluentProvider>
71+
);
72+
}
73+
74+
renderWebChat();
75+
76+
await pageConditions.uiConnected();
77+
78+
await directLine.emulateIncomingActivity({
79+
type: 'message',
80+
id: 'a-00000',
81+
timestamp: 0,
82+
text: 'This is a test message to show feedback buttons',
83+
from: {
84+
role: 'bot'
85+
},
86+
locale: 'en-US',
87+
entities: [],
88+
channelData: {
89+
feedbackLoop: {
90+
type: 'default',
91+
disclaimer: 'This is a test disclaimer message'
92+
}
93+
}
94+
});
95+
96+
await pageConditions.numActivitiesShown(1);
97+
98+
pageElements.byTestId('send box text area').focus();
99+
await host.sendShiftTab(2);
100+
101+
await host.sendKeys('ENTER');
102+
await host.sendKeys('ENTER');
103+
104+
await host.snapshot('local');
105+
106+
// Dismiss like button
107+
await host.sendShiftTab(2);
108+
await host.sendKeys('ENTER');
109+
110+
await host.snapshot('local');
111+
112+
// Click like button
113+
await host.sendKeys('ENTER');
114+
115+
await pageConditions.became(
116+
'feedback form is open',
117+
() => document.activeElement === pageElements.byTestId('feedback sendbox'),
118+
1000
119+
);
120+
121+
// Go to cancel button
122+
await host.sendTab(2);
123+
await host.sendKeys('ENTER');
124+
125+
await host.snapshot('local');
126+
127+
pageElements.byTestId('send box text area').focus();
128+
await host.sendShiftTab(2);
129+
130+
await host.sendKeys('ENTER');
131+
// Send dislike
132+
await host.sendTab(1);
133+
await host.sendKeys('ENTER');
134+
135+
await pageConditions.became(
136+
'feedback form is open',
137+
() => document.activeElement === pageElements.byTestId('feedback sendbox'),
138+
1000
139+
);
140+
141+
await host.sendKeys('Test feedback');
142+
143+
await host.snapshot('local');
144+
145+
const { activity } = await directLine.actPostActivity(async () => {
146+
await host.sendTab(1);
147+
await host.sendKeys('ENTER');
148+
});
149+
150+
expect(activity).toEqual(
151+
expect.objectContaining({
152+
type: 'invoke',
153+
name: 'message/submitAction',
154+
value: {
155+
actionName: 'feedback',
156+
actionValue: {
157+
reaction: 'dislike',
158+
feedback: {
159+
feedbackText: 'Test feedback'
160+
}
161+
}
162+
}
163+
})
164+
);
165+
});
166+
</script>
167+
</body>
168+
</html>
25.6 KB
Loading
13.4 KB
Loading
13.1 KB
Loading
21.9 KB
Loading
-53 Bytes
Loading
-48 Bytes
Loading
481 Bytes
Loading

packages/fluent-theme/src/components/theme/Theme.module.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -627,15 +627,15 @@
627627
/* Feedback Form */
628628
:global(.webchat-fluent).theme :global(.webchat__feedback-form__body1) {
629629
font-family: var(--webchat-fontFamilyBase);
630-
color: var(--webchat-colorGray200);
630+
color: var(--webchat-colorNeutralForeground1);
631631
font-size: var(--webchat-fontSizeBase300);
632632
font-weight: var(--webchat-fontWeightRegular);
633633
line-height: var(--webchat-lineHeightBase300);
634634
}
635635

636636
:global(.webchat-fluent).theme :global(.webchat__feedback-form__caption1) {
637637
font-family: var(--webchat-fontFamilyBase);
638-
color: var(--webchat-colorNeutralForeground3);
638+
color: var(--webchat-colorNeutralForeground1);
639639
font-size: var(--webchat-fontSizeBase100);
640640
font-weight: var(--webchat-fontWeightRegular);
641641
line-height: var(--webchat-lineHeightBase200);
@@ -645,7 +645,7 @@
645645
background-color: var(--webchat-colorBrandForeground1);
646646
border: var(--webchat-strokeWidthThin) solid var(--webchat-colorBrandForeground1);
647647
border-radius: var(--webchat-borderRadiusMedium);
648-
color: var(--webchat-colorNeutralBackground1);
648+
color: #ffffff; /* Always white in dark and light mode */
649649
cursor: pointer;
650650
font-family: var(--webchat-fontFamilyBase);
651651
font-size: var(--webchat-fontSizeBase300);
@@ -671,7 +671,7 @@
671671
background-color: var(--webchat-colorNeutralBackground1);
672672
border: var(--webchat-strokeWidthThin) solid var(--webchat-colorNeutralStroke1);
673673
border-radius: var(--webchat-borderRadiusMedium);
674-
color: var(--webchat-colorNeutralForeground3);
674+
color: var(--webchat-colorNeutralForeground1);
675675
cursor: pointer;
676676
font-family: var(--webchat-fontFamilyBase);
677677
font-size: var(--webchat-fontSizeBase300);

0 commit comments

Comments
 (0)