mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-10 18:03:47 +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 PopoverPicker from '../input/popover-picker/PopoverPicker';
|
||||
import SwatchPicker from '../input/colour-input/SwatchPicker';
|
||||
|
||||
import style from './InlineColourPicker.module.scss';
|
||||
|
||||
@@ -20,13 +20,9 @@ export default function InlineColourPicker(props: InlineColourPickerProps) {
|
||||
const { name, value } = props;
|
||||
const [colour, setColour] = useState(() => ensureHex(value));
|
||||
|
||||
const debouncedChange = (value: string) => {
|
||||
setColour(value);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={style.inline}>
|
||||
<PopoverPicker color={colour} onChange={debouncedChange} />
|
||||
<SwatchPicker color={colour} onChange={setColour} />
|
||||
<input type='hidden' name={name} value={colour} />
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user