Skip to content

Commit 03cb9fb

Browse files
committed
feat: update color for creatable option
1 parent 457bdf8 commit 03cb9fb

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/Shared/Components/SelectPicker/common.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ export const SelectPickerOption = ({
114114
} = props
115115
const { description, startIcon, endIcon } = data ?? {}
116116
const showDescription = !!description
117+
// __isNew__ denotes the new option to be created
118+
const isCreatableOption = '__isNew__' in data && data.__isNew__
117119

118120
const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
119121
e.preventDefault()
@@ -124,8 +126,7 @@ export const SelectPickerOption = ({
124126
return (
125127
<components.Option {...props}>
126128
<div className="flexbox dc__align-items-center dc__gap-8">
127-
{/* __isNew__ denotes the new option to be created */}
128-
{isMulti && !('__isNew__' in data && data.__isNew__) && (
129+
{isMulti && !isCreatableOption && (
129130
<Checkbox
130131
onChange={noop}
131132
onClick={handleChange}
@@ -139,7 +140,9 @@ export const SelectPickerOption = ({
139140
<div className="dc__no-shrink icon-dim-20 flex dc__fill-available-space">{startIcon}</div>
140141
)}
141142
<div className="flex-grow-1">
142-
<h4 className="m-0 cn-9 fs-13 fw-4 lh-20 dc__truncate">{label}</h4>
143+
<h4 className={`m-0 fs-13 ${isCreatableOption ? 'cb-5' : 'cn-9'} fw-4 lh-20 dc__truncate`}>
144+
{label}
145+
</h4>
143146
{/* Add support for custom ellipsis if required */}
144147
{showDescription && (
145148
<p
@@ -276,7 +279,6 @@ export const SelectPickerGroupHeading = ({
276279
return (
277280
<components.GroupHeading {...props} onClick={toggleGroupHeadingSelection}>
278281
<div className="flexbox dc__align-items-center dc__gap-8">
279-
{/* __isNew__ denotes the new option to be created */}
280282
{isGroupHeadingSelectable && (
281283
<Checkbox
282284
onChange={noop}

src/Shared/Components/SelectPicker/utils.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,6 @@ export const getCommonSelectStyle = ({
9999
menuList: (base) => ({
100100
...base,
101101
padding: 0,
102-
103-
// Override the padding of the first group header
104-
'> div': {
105-
'> :first-child': {
106-
paddingTop: 0,
107-
},
108-
},
109102
}),
110103
control: (base, state) => ({
111104
...base,
@@ -229,6 +222,10 @@ export const getCommonSelectStyle = ({
229222
...base,
230223
paddingTop: '4px',
231224
paddingBottom: 0,
225+
226+
'&:first-child': {
227+
paddingTop: 0,
228+
},
232229
}),
233230
groupHeading: (base) => ({
234231
...base,

0 commit comments

Comments
 (0)