Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: inline colour picker #1412

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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} />
cpvalente marked this conversation as resolved.
Show resolved Hide resolved
<input type='hidden' name={name} value={colour} />
</div>
);
Expand Down
Loading