Skip to content

Commit

Permalink
Adds the non-standard swatch to palette as user selects a color in th…
Browse files Browse the repository at this point in the history
…e color picker.
  • Loading branch information
eireland committed Oct 28, 2024
1 parent ad2b8a0 commit 9ed34ed
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const PointColorSetting = observer(function PointColorSetting({onColorCha

const updateValue = useCallback((value: string) => {
setInputValue(value)
setNonStandardColorSelected(true)

Check warning on line 46 in v3/src/components/data-display/inspector/point-color-setting.tsx

View check run for this annotation

Codecov / codecov/patch

v3/src/components/data-display/inspector/point-color-setting.tsx#L44-L46

Added lines #L44 - L46 were not covered by tests
if (attrType === "categorical") {
(onColorChange as (color: string, cat: string) => void)(value, propertyLabel)

Check warning on line 48 in v3/src/components/data-display/inspector/point-color-setting.tsx

View check run for this annotation

Codecov / codecov/patch

v3/src/components/data-display/inspector/point-color-setting.tsx#L48

Added line #L48 was not covered by tests
} else if (attrType === "numeric") {
Expand All @@ -54,6 +55,8 @@ export const PointColorSetting = observer(function PointColorSetting({onColorCha

const rejectValue = useCallback(() => {
setShowColorPicker(false)
setOpenPopover(null)
setNonStandardColorSelected(false)

Check warning on line 59 in v3/src/components/data-display/inspector/point-color-setting.tsx

View check run for this annotation

Codecov / codecov/patch

v3/src/components/data-display/inspector/point-color-setting.tsx#L56-L59

Added lines #L56 - L59 were not covered by tests
}, [])

const acceptValue = useCallback(() => {
Expand All @@ -68,10 +71,6 @@ export const PointColorSetting = observer(function PointColorSetting({onColorCha
evt.stopPropagation()
setShowColorPicker(!showColorPicker)

Check warning on line 72 in v3/src/components/data-display/inspector/point-color-setting.tsx

View check run for this annotation

Codecov / codecov/patch

v3/src/components/data-display/inspector/point-color-setting.tsx#L69-L72

Added lines #L69 - L72 were not covered by tests
}

// const baseColors = ["#000000", "#a9a9a9", "#d3d3d3", "#FFFFFF"]
// const standardSwatchColors = [...baseColors, ...kellyColors.slice(0, 12)]

useEffect(() => {
const adjustPosition = () => {
const popover = popoverRef.current
Expand Down

0 comments on commit 9ed34ed

Please sign in to comment.