261116_03_ENH: KriColorPalette 중첩 삼항 제거 및 Dice UI 출처 주석 추가

This commit is contained in:
2026-11-16 16:54:42 +09:00
parent e64a48417b
commit 623615a287
3 changed files with 11 additions and 8 deletions

View File

@@ -153,6 +153,7 @@ export function KriColorPalette({
const parsedColor = parseHexColor(color) const parsedColor = parseHexColor(color)
if (!parsedColor) return null if (!parsedColor) return null
const selected = parsedColor.rgb === parsedValue?.rgb const selected = parsedColor.rgb === parsedValue?.rgb
const checkColorClass = isLightHexColor(parsedColor.rgb) ? 'text-black' : 'text-white'
return ( return (
<button <button
key={parsedColor.rgb} key={parsedColor.rgb}
@@ -164,9 +165,7 @@ export function KriColorPalette({
title={parsedColor.rgb} title={parsedColor.rgb}
onClick={() => selectDiscrete(withAlpha(parsedColor.rgb))} onClick={() => selectDiscrete(withAlpha(parsedColor.rgb))}
> >
{selected ? ( {selected ? <Check className={cn('size-3.5', checkColorClass)} /> : null}
<Check className={cn('size-3.5', isLightHexColor(parsedColor.rgb) ? 'text-black' : 'text-white')} />
) : null}
</button> </button>
) )
})} })}

View File

@@ -1,5 +1,8 @@
"use client"; "use client";
// Adapted from Dice UI color-picker (Radix variant), https://www.diceui.com/docs/components/radix/color-picker (MIT License).
// 로컬 변경: import 경로, 아이콘(lucide PipetteIcon), 빈 interface lint 수정.
import { cva, type VariantProps } from "class-variance-authority"; import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import { import {

View File

@@ -101,11 +101,12 @@ function VisuallyHiddenInput<T = InputValue>(
const propertyKey = isCheckInput ? "checked" : "value"; const propertyKey = isCheckInput ? "checked" : "value";
const eventType = isCheckInput ? "click" : "input"; const eventType = isCheckInput ? "click" : "input";
const serializedCurrentValue = isCheckInput let serializedCurrentValue: unknown = value;
? checked if (isCheckInput) {
: typeof value === "object" && value !== null serializedCurrentValue = checked;
? JSON.stringify(value) } else if (typeof value === "object" && value !== null) {
: value; serializedCurrentValue = JSON.stringify(value);
}
const descriptor = Object.getOwnPropertyDescriptor(inputProto, propertyKey); const descriptor = Object.getOwnPropertyDescriptor(inputProto, propertyKey);