// axi0 Motion 0.2.0: Like heart. A like button whose heart squeezes to a dot, flips color and bursts back while the count rolls over to the next number.
// Generated from src/like-heart/meta.json by motion-pack: a thin wrapper. The loader (motion.js) must be on the page once;
// it starts the effect on the element this renders. Options left out keep the effect's own defaults.
import { createElement } from "react";
import type { HTMLAttributes, ReactNode } from "react";

export interface LikeHeartProps extends HTMLAttributes<HTMLElement> {
  /** the count before your like (default 0) */
  count?: number;
  /** the heart's color when liked (default "#ff4d6d") */
  color?: string;
  /** The element to render (default "div") */
  as?: string;
  children?: ReactNode;
}

const s = (v: unknown) => (v === undefined ? undefined : String(v));

export function LikeHeart({ as = "div", count, color, ...rest }: LikeHeartProps) {
  return createElement(as, { ...rest, "data-motion": "like-heart", "data-motion-count": s(count), "data-motion-color": s(color) });
}

export default LikeHeart;
