"use client";
import { CircleSlash } from "lucide-react";
import type { HSL } from "@/lib/character/color-utils";
import { NONE_VARIANT_ID, PIECE_SLOT_COUNT } from "@/lib/character/presets";
import { cn } from "@/lib/utils";
import type { LayerVariant } from "@/lib/character/presets";
import { TintedSpriteIcon } from "./tinted-sprite-icon";
type CharacterPieceSelectorProps = {
variants: LayerVariant[];
activeId: string;
color: HSL;
skinColor?: HSL;
onSelect: (variantId: string) => void;
};
export function CharacterPieceSelector({
variants,
activeId,
color,
skinColor,
onSelect,
}: CharacterPieceSelectorProps) {
const slots = Array.from({ length: PIECE_SLOT_COUNT }, (_, index) =>
variants[index] ?? null,
);
return (
{slots.map((variant, index) => {
if (!variant) {
return (
);
}
if (variant.id === NONE_VARIANT_ID) {
return (
);
}
return (
);
})}
);
}