"use client";

import { Chip, ChipProps } from "@/components/ui";

import styles from "./Chips.module.scss";

interface ChipsProps {
  chips: Omit<ChipProps, "onClick">[];
  activeChips: string[];
  onChipClick?: (chip: Omit<ChipProps, "onClick">) => void;
}

export default function Chips({ chips, activeChips, onChipClick }: ChipsProps) {
  return (
    <div className={styles.chips}>
      {chips.map(chip => (
        <Chip
          key={chip.text}
          {...chip}
          active={activeChips.includes(chip.text)}
          onClick={() => onChipClick?.(chip)}
        />
      ))}
    </div>
  );
}
