Skip to content

Commit bbd7501

Browse files
committed
fix: Override assistant icon color in MUI Chip 🐛
Render SVG icons directly with inline transparent fill/color to prevent MUI Chip's icon styles from overriding the multicolor sparkle appearance. Also fix .id -> ._id for default assistant comparison.
1 parent 7ddb9c2 commit bbd7501

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

packages/cozy-search/src/components/Assistant/AssistantAvatar.jsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,42 @@
11
import cx from 'classnames'
22
import React from 'react'
33

4-
import Icon from 'cozy-ui/transpiled/react/Icon'
54
import AssistantIcon from 'cozy-ui/transpiled/react/Icons/Assistant'
65
import AssistantColorIcon from 'cozy-ui/transpiled/react/Icons/AssistantColor'
76

87
import styles from './styles.styl'
98
import { DEFAULT_ASSISTANT } from '../constants'
109

10+
const transparentFillStyle = { fill: 'transparent', color: 'transparent' }
11+
1112
const AssistantAvatar = ({ assistant, isSmall, className }) => {
1213
if (!assistant) return null
1314

1415
if (assistant._id !== DEFAULT_ASSISTANT._id && !assistant.icon) {
1516
return (
16-
<Icon
17-
icon={AssistantIcon}
17+
<AssistantIcon
1818
className={cx(
1919
styles['assistant-icon'],
2020
{
2121
[styles['assistant-icon--small']]: isSmall
2222
},
2323
className
2424
)}
25+
style={transparentFillStyle}
2526
/>
2627
)
2728
}
2829

29-
return assistant.id === DEFAULT_ASSISTANT.id ? (
30-
<Icon
31-
icon={AssistantColorIcon}
30+
return assistant._id === DEFAULT_ASSISTANT._id ? (
31+
<AssistantColorIcon
3232
className={cx(
3333
styles['assistant-icon'],
3434
{
3535
[styles['assistant-icon--small']]: isSmall
3636
},
3737
className
3838
)}
39+
style={transparentFillStyle}
3940
/>
4041
) : (
4142
<img

packages/cozy-search/src/components/Assistant/AssistantSelection.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const AssistantSelection = ({ className, disabled }) => {
111111
<AssistantSelectionItem
112112
assistant={DEFAULT_ASSISTANT}
113113
onClose={handleClose}
114-
onSelect={() => setSelectedAssistantId(DEFAULT_ASSISTANT.id)}
114+
onSelect={() => setSelectedAssistantId(DEFAULT_ASSISTANT._id)}
115115
selectedAssistant={selectedAssistant}
116116
disableActions={true}
117117
/>

packages/cozy-search/src/components/Assistant/styles.styl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
margin-right 8px
2424
object-fit cover
2525
fill transparent !important
26+
color transparent !important
2627

2728
&--small
2829
width 20px

0 commit comments

Comments
 (0)