import { ComponentProps, RefObject, useImperativeHandle, useRef } from "react"; import clsx from "clsx"; import { useRipple } from "../../hooks/useRipple"; import { ButtonProps, buttonVariants } from "./Button"; export type HrefButtonProps = ComponentProps<"a"> & Pick< ButtonProps, "withRipple" | "variant" | "size" | "color" | "selected" | "icon" | "disabled" | "width" > & { ref?: RefObject }; export function HrefButton({ withRipple = true, variant = "contained", color = "yellow", size = "medium", width = "fit", className, disabled, children, selected = false, icon = false, href, ref, ...props }: HrefButtonProps) { const anchorRef = useRef(null!); useImperativeHandle( ref, () => anchorRef.current, ); const ripples = useRipple(anchorRef); return ( {!disabled && withRipple && ripples} {children} ); }