Skip to content

Commit

Permalink
refactor: inline colour picker
Browse files Browse the repository at this point in the history
  • Loading branch information
Shobhit-Nagpal authored and cpvalente committed Jan 2, 2025
1 parent f4f24da commit 1ba48c6
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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>
);
Expand Down

0 comments on commit 1ba48c6

Please sign in to comment.