Skip to content

Commit

Permalink
address code review
Browse files Browse the repository at this point in the history
  • Loading branch information
matoous committed Oct 12, 2024
1 parent 5c66fc4 commit 2a58c47
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
box-shadow: 0 0 0 2px var(--cui-border-focus);
}

.picker[data-disabled="true"] {
color: var(--cui-fg-normal-disabled);
background-color: var(--cui-bg-normal-disabled);
box-shadow: 0 0 0 1px var(--cui-border-normal-disabled);
}

.color-input {
width: var(--cui-spacings-giga);
height: var(--cui-spacings-giga);
Expand Down Expand Up @@ -80,4 +86,4 @@

.input::placeholder {
font-family: var(--cui-font-stack-mono);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ describe('ColorInput', () => {
) as HTMLInputElement;

await userEvent.click(colorInput);
await userEvent.paste('oviously invalid');
await userEvent.paste('obviously invalid');

const colorPicker = container.querySelector(
"input[type='color']",
Expand Down
13 changes: 6 additions & 7 deletions packages/circuit-ui/components/ColorInput/ColorInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,7 @@ export const ColorInput = forwardRef<InputElement, ColorInputProps>(
const hasSuffix = Boolean(suffix);

const handlePaste: ClipboardEventHandler<InputElement> = (e) => {
if (
!colorPickerRef.current ||
!colorInputRef.current ||
disabled ||
readOnly
) {
if (!colorPickerRef.current || !colorInputRef.current || readOnly) {
return;
}

Expand Down Expand Up @@ -165,7 +160,11 @@ export const ColorInput = forwardRef<InputElement, ColorInputProps>(
/>
</FieldLegend>
<div className={classes.wrapper}>
<label htmlFor={pickerId} className={classes.picker}>
<label
htmlFor={pickerId}
className={classes.picker}
data-disabled={disabled}
>
<input
id={pickerId}
ref={applyMultipleRefs(colorPickerRef, ref)}
Expand Down

0 comments on commit 2a58c47

Please sign in to comment.