Skip to content

Commit 2392578

Browse files
committed
chore: add darkmode, use consts, fix prettier
1 parent dd23582 commit 2392578

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

packages/compass-assistant/src/assistant-chat.tsx

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import {
1212
css,
1313
Banner,
1414
cx,
15+
fontFamilies,
16+
palette,
17+
useDarkMode,
1518
} from '@mongodb-js/compass-components';
1619

1720
const { ChatWindow } = LgChatChatWindow;
@@ -34,6 +37,18 @@ const assistantChatStyles = css({
3437
},
3538
});
3639

40+
const headerStyleDarkModeFixes = css({
41+
'h1, h2, h3, h4, h5, h6': {
42+
color: palette.gray.light2,
43+
},
44+
});
45+
46+
const headerStyleLightModeFixes = css({
47+
'h1, h2, h3, h4, h5, h6': {
48+
color: palette.black,
49+
},
50+
});
51+
3752
// TODO(COMPASS-9751): These are temporary patches to make the Assistant chat take the entire
3853
// width and height of the drawer since Leafygreen doesn't support this yet.
3954
const assistantChatFixesStyles = css({
@@ -49,9 +64,7 @@ const assistantChatFixesStyles = css({
4964
/** TODO(COMPASS-9751): We're adjusting styling of all the headers to a lower level than the default for chat, this should be updated in Leafygreen as well and removed from our end. */
5065
'h1, h2, h3, h4, h5, h6': {
5166
margin: 'unset',
52-
color: '#001E2B',
53-
fontFamily:
54-
"'Euclid Circular A','Helvetica Neue',Helvetica,Arial, sans-serif",
67+
fontFamily: fontFamilies.default,
5568
},
5669
/** h4, h5, h6 -> body 1 styling */
5770
'h4, h5, h6': {
@@ -92,6 +105,7 @@ const errorBannerWrapperStyles = css({
92105
export const AssistantChat: React.FunctionComponent<AssistantChatProps> = ({
93106
chat,
94107
}) => {
108+
const darkMode = useDarkMode();
95109
const { messages, sendMessage, status, error, clearError } = useChat({
96110
chat,
97111
});
@@ -122,7 +136,11 @@ export const AssistantChat: React.FunctionComponent<AssistantChatProps> = ({
122136
return (
123137
<div
124138
data-testid="assistant-chat"
125-
className={cx(assistantChatFixesStyles, assistantChatStyles)}
139+
className={cx(
140+
assistantChatFixesStyles,
141+
assistantChatStyles,
142+
darkMode ? headerStyleDarkModeFixes : headerStyleLightModeFixes
143+
)}
126144
style={{ height: '100%', width: '100%' }}
127145
>
128146
<LeafyGreenChatProvider variant={Variant.Compact}>

packages/hadron-document/src/document-events.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ export const DocumentEvents = {
2222
} as const;
2323

2424
export type DocumentEventsType =
25-
typeof DocumentEvents[keyof typeof DocumentEvents];
25+
(typeof DocumentEvents)[keyof typeof DocumentEvents];

packages/hadron-document/src/element-events.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ export const ElementEvents = {
1515
} as const;
1616

1717
export type ElementEventsType =
18-
typeof ElementEvents[keyof typeof ElementEvents];
18+
(typeof ElementEvents)[keyof typeof ElementEvents];

0 commit comments

Comments
 (0)