mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-28 10:29:11 +00:00
refactor: inline colour picker
This commit is contained in:
committed by
Carlos Valente
parent
f4f24da47b
commit
1ba48c6a6f
@@ -1,6 +1,6 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
|
||||||
import PopoverPicker from '../input/popover-picker/PopoverPicker';
|
import SwatchPicker from '../input/colour-input/SwatchPicker';
|
||||||
|
|
||||||
import style from './InlineColourPicker.module.scss';
|
import style from './InlineColourPicker.module.scss';
|
||||||
|
|
||||||
@@ -20,13 +20,9 @@ export default function InlineColourPicker(props: InlineColourPickerProps) {
|
|||||||
const { name, value } = props;
|
const { name, value } = props;
|
||||||
const [colour, setColour] = useState(() => ensureHex(value));
|
const [colour, setColour] = useState(() => ensureHex(value));
|
||||||
|
|
||||||
const debouncedChange = (value: string) => {
|
|
||||||
setColour(value);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={style.inline}>
|
<div className={style.inline}>
|
||||||
<PopoverPicker color={colour} onChange={debouncedChange} />
|
<SwatchPicker color={colour} onChange={setColour} />
|
||||||
<input type='hidden' name={name} value={colour} />
|
<input type='hidden' name={name} value={colour} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user