better typecheck for them input
This commit is contained in:
parent
32183b9758
commit
b301a37e7d
1 changed files with 1 additions and 1 deletions
|
|
@ -5,7 +5,7 @@ import ColourPicker from './ColourPicker.jsx';
|
|||
|
||||
const Input = ({ value, onChange }) => {
|
||||
// Number type
|
||||
if (!isNaN(value)) return <input type="number" value={value} onChange={(e) => onChange(Number(e.target.value))}/>;
|
||||
if ((value || value === 0) && !isNaN(value)) return <input type="number" value={value} onChange={(e) => onChange(Number(e.target.value))}/>;
|
||||
// Colour type
|
||||
if (!/var\(.*\)/i.test(value) && CSS.supports('color', value)) return (
|
||||
<ColourPicker colour={value} onChange={onChange} />
|
||||
|
|
|
|||
Loading…
Reference in a new issue