Skip to content

Commit ca46f53

Browse files
committed
Color picker selection
1 parent c56893d commit ca46f53

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/component/field/ColorPicker.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { useState } from 'react';
22
import { ColorPicker } from 'mui-color';
33

44
const NeoColorPicker = ({ value, onChange, defaultValue, label, style }) => {
@@ -11,7 +11,14 @@ const NeoColorPicker = ({ value, onChange, defaultValue, label, style }) => {
1111
key={label}
1212
defaultValue={defaultValue}
1313
value={value}
14-
onChange={(e) => onChange(e?.css?.backgroundColor ?? null)}
14+
onChange={(e) => {
15+
if (e?.css?.backgroundColor) {
16+
onChange(e?.css?.backgroundColor);
17+
}
18+
if (typeof e === 'string' || e instanceof String) {
19+
onChange(e);
20+
}
21+
}}
1522
/>
1623
</div>
1724
<div className='ndl-form-item-wrapper'>

0 commit comments

Comments
 (0)