UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
fix: ripple button fixes
Dillion Verma55397cbcb9b0
diff --git a/config/docs.ts b/config/docs.tsindex d0ac2152..36a5f612 100644--- a/config/docs.ts+++ b/config/docs.ts@@ -191,7 +191,7 @@ export const docsConfig: DocsConfig = {title: "Code Comparison",href: `/docs/components/code-comparison`,items: [],- label: "New",+ label: "",},],},@@ -419,7 +419,7 @@ export const docsConfig: DocsConfig = {title: "Ripple Button",href: "/docs/components/ripple-button",items: [],- label: "",+ label: "New",},],},diff --git a/content/docs/components/ripple-button.mdx b/content/docs/components/ripple-button.mdxindex a90e6f1c..4ad54e4f 100644--- a/content/docs/components/ripple-button.mdx+++ b/content/docs/components/ripple-button.mdx@@ -1,6 +1,6 @@---title: Ripple Button-date: 2024-10-19+date: 2024-11-17description: An animated button with ripple useful for user engagement.author: Sidd5arthpublished: true@@ -38,7 +38,7 @@ npx shadcn@latest add "https://magicui.design/r/ripple-button"Add the following animations to your `tailwind.config.js` file:-```js title="tailwind.config.js" {5-13}+```js title="tailwind.config.js" {5-20}/** @type {import('tailwindcss').Config} */// tailwind.config.jsmodule.exports = {diff --git a/registry/default/magicui/ripple-button.tsx b/registry/default/magicui/ripple-button.tsxindex ebbe7a70..ff132723 100644--- a/registry/default/magicui/ripple-button.tsx+++ b/registry/default/magicui/ripple-button.tsx@@ -1,7 +1,7 @@"use client";-import React, { useState, useEffect, MouseEvent } from "react";import { cn } from "@/lib/utils";+import React, { MouseEvent, useEffect, useState } from "react";interface RippleButtonPropsextends React.ButtonHTMLAttributes<HTMLButtonElement> {@@ -19,7 +19,7 @@ const RippleButton = React.forwardRef<HTMLButtonElement, RippleButtonProps>(onClick,...props},- ref,+ ref) => {const [buttonRipples, setButtonRipples] = useState<Array<{ x: number; y: number; size: number; key: number }>@@ -46,7 +46,7 @@ const RippleButton = React.forwardRef<HTMLButtonElement, RippleButtonProps>(const lastRipple = buttonRipples[buttonRipples.length - 1];const timeout = setTimeout(() => {setButtonRipples((prevRipples) =>- prevRipples.filter((ripple) => ripple.key !== lastRipple.key),+ prevRipples.filter((ripple) => ripple.key !== lastRipple.key));}, parseInt(duration));return () => clearTimeout(timeout);@@ -56,8 +56,8 @@ const RippleButton = React.forwardRef<HTMLButtonElement, RippleButtonProps>(return (<buttonclassName={cn(- "bg-black-500 relative flex cursor-pointer items-center justify-center overflow-hidden rounded-lg border-2 bg-background px-4 py-2 text-center text-primary",- className,+ "relative flex cursor-pointer items-center justify-center overflow-hidden rounded-lg border-2 bg-background px-4 py-2 text-center text-primary",+ className)}onClick={handleClick}ref={ref}@@ -82,7 +82,7 @@ const RippleButton = React.forwardRef<HTMLButtonElement, RippleButtonProps>(</span></button>);- },+ });RippleButton.displayName = "RippleButton";