Skip to content

Commit 3f170c9

Browse files
authored
fix(assistant): make blockquote and hr tags look not broken COMPASS-9872 (#7370)
* make blockquote and hr tags look not broken * camelCase
1 parent aa42d0c commit 3f170c9

File tree

1 file changed

+42
-19
lines changed

1 file changed

+42
-19
lines changed

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

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,31 +36,17 @@ interface AssistantChatProps {
3636
hasNonGenuineConnections: boolean;
3737
}
3838

39-
const assistantChatStyles = css({
39+
// TODO(COMPASS-9751): These are temporary patches to make the Assistant chat take the entire
40+
// width and height of the drawer since Leafygreen doesn't support this yet.
41+
const assistantChatFixesStyles = css({
4042
// Compass has a global bullet point override but we clear this for the chat.
4143
ul: {
4244
listStyleType: 'disc',
4345
},
4446
ol: {
4547
listStyleType: 'decimal',
4648
},
47-
});
48-
49-
const headerStyleDarkModeFixes = css({
50-
'h1, h2, h3, h4, h5, h6': {
51-
color: palette.gray.light2,
52-
},
53-
});
5449

55-
const headerStyleLightModeFixes = css({
56-
'h1, h2, h3, h4, h5, h6': {
57-
color: palette.black,
58-
},
59-
});
60-
61-
// TODO(COMPASS-9751): These are temporary patches to make the Assistant chat take the entire
62-
// width and height of the drawer since Leafygreen doesn't support this yet.
63-
const assistantChatFixesStyles = css({
6450
// Remove extra padding
6551
'> div, > div > div, > div > div > div, > div > div > div': {
6652
height: '100%',
@@ -105,7 +91,45 @@ const assistantChatFixesStyles = css({
10591
lineHeight: '18px',
10692
marginTop: '4px',
10793
},
94+
blockquote: {
95+
// remove the 3x line height that these take up by default
96+
lineHeight: 0,
97+
margin: 0,
98+
borderLeftWidth: spacing[100],
99+
borderLeftStyle: 'solid',
100+
padding: `0 0 0 ${spacing[200]}px`,
101+
102+
'> * + *': {
103+
margin: `${spacing[400]}px 0 0`,
104+
},
105+
},
106+
hr: {
107+
// hr tags have no width when it is alone in a chat message because of the
108+
// overall layout in chat where the chat bubble sizes to fit the content.
109+
// The minimum width of the drawer sized down to the smallest size leaves
110+
// 200px.
111+
minWidth: '200px',
112+
},
108113
});
114+
115+
const assistantChatFixesDarkStyles = css({
116+
'h1, h2, h3, h4, h5, h6': {
117+
color: palette.gray.light2,
118+
},
119+
blockquote: {
120+
borderLeftColor: palette.gray.light1,
121+
},
122+
});
123+
124+
const assistantChatFixesLightStyles = css({
125+
'h1, h2, h3, h4, h5, h6': {
126+
color: palette.black,
127+
},
128+
blockquote: {
129+
borderLeftColor: palette.gray.dark1,
130+
},
131+
});
132+
109133
const messageFeedFixesStyles = css({
110134
display: 'flex',
111135
flexDirection: 'column-reverse',
@@ -310,8 +334,7 @@ export const AssistantChat: React.FunctionComponent<AssistantChatProps> = ({
310334
data-testid="assistant-chat"
311335
className={cx(
312336
assistantChatFixesStyles,
313-
assistantChatStyles,
314-
darkMode ? headerStyleDarkModeFixes : headerStyleLightModeFixes
337+
darkMode ? assistantChatFixesDarkStyles : assistantChatFixesLightStyles
315338
)}
316339
style={{ height: '100%', width: '100%' }}
317340
>

0 commit comments

Comments
 (0)