Skip to content

Commit

Permalink
fix: incorrect cursor style for ColorPicker & BooleanToggle (#184)
Browse files Browse the repository at this point in the history
* fix: Color Picker should not show `cursor: pointer` in text-only mode

* fix: Boolean Toggle should show `cursor: pointer` in non-text-only mode

* refactor: add class `jse-readonly` to Color Picker & Boolean Toggle to avoid using `:global` in local style

* style: padding is included in the clickable area of `.jse-boolean-toggle`
  • Loading branch information
cloydlau authored Nov 4, 2022
1 parent 2cece4e commit 12e60e5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib/plugins/value/components/BooleanToggle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@
padding-top: 1px;
height: var(--jse-line-height);
}

.jse-boolean-toggle:not(.jse-readonly) {
cursor: pointer;
}
1 change: 1 addition & 0 deletions src/lib/plugins/value/components/BooleanToggle.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

<div
class="jse-boolean-toggle"
class:jse-readonly={readOnly}
on:mousedown={toggleBooleanValue}
title={!readOnly ? 'Click to toggle this boolean value' : `Boolean value ${value}`}
>
Expand Down
3 changes: 3 additions & 0 deletions src/lib/plugins/value/components/ColorPicker.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
border-radius: 2px;
background: inherit;
outline: none;
}

.jse-color-picker-button:not(.jse-readonly) {
cursor: pointer;
}
1 change: 1 addition & 0 deletions src/lib/plugins/value/components/ColorPicker.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
<button
type="button"
class="jse-color-picker-button"
class:jse-readonly={readOnly}
style="background: {color}"
title={!readOnly ? 'Click to open a color picker' : `Color ${value}`}
on:click={openColorPicker}
Expand Down

0 comments on commit 12e60e5

Please sign in to comment.