// axi0 Motion 0.2.0: Rise nav. Links in a pill bar: under the pointer a fill rises through a link while its label rolls over, a dot glides under the current page, and narrow screens get a menu button.
// Generated from src/rise-nav/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 RiseNavProps extends HTMLAttributes<HTMLElement> {
  /** the color that rises through a link (empty: the accent) (default auto) */
  fill?: string;
  /** below this page width the links fold into a menu button (default 560) */
  collapse?: number;
  /** the menu button's name (default "Menu") */
  menu?: string;
  /** The element to render (default "div") */
  as?: string;
  children?: ReactNode;
}

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

export function RiseNav({ as = "div", fill, collapse, menu, ...rest }: RiseNavProps) {
  return createElement(as, { ...rest, "data-motion": "rise-nav", "data-motion-fill": s(fill), "data-motion-collapse": s(collapse), "data-motion-menu": s(menu) });
}

export default RiseNav;
