import styles from "./chip.module.css";
interface Props extends React.ComponentProps<"span"> {
  children: React.ReactNode;
  onCloseClick?: (() => void) | undefined;
}
const Chip = ({ children, onCloseClick, ...props }: Props) => {
  return (
    <span
      {...props}
      className={styles.chip}
      onClick={(e) => e.stopPropagation()}
    >
      {children}
      {onCloseClick && (
        <span
          className={"codicon codicon-close " + styles.close}
          onClick={onCloseClick}
        ></span>
      )}
    </span>
  );
};

export default Chip;
