// axi0 Motion 0.2.0: Shiny text. A band of light sweeps across the text, again and again.
// Generated from src/shiny/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 ShinyProps extends HTMLAttributes<HTMLElement> {
  /** seconds per pass (default 3) */
  speed?: number;
  /** the band's color; auto mixes a light shade of the text color (default auto) */
  color?: string;
  /** The element to render (default "div") */
  as?: string;
  children?: ReactNode;
}

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

export function Shiny({ as = "div", speed, color, ...rest }: ShinyProps) {
  return createElement(as, { ...rest, "data-motion": "shiny", "data-motion-speed": s(speed), "data-motion-color": s(color) });
}

export default Shiny;
