Skip to content

UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.

fix: animate-subscribe-button-color (#137)

Tomonari Feehan7b3bd6f655ce
diff --git a/content/docs/components/animated-subscribe-button.mdx b/content/docs/components/animated-subscribe-button.mdx
index ae5eabb8..f1161cad 100644
--- a/content/docs/components/animated-subscribe-button.mdx
+++ b/content/docs/components/animated-subscribe-button.mdx
@@ -26,9 +26,9 @@ components/magicui/animated-subscribe-button.tsx
| Prop | Type | Description |
| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| **brand** | string | The accent color for the button. This allows you to set a custom color that matches your brand's theme. |
-| **subscribeStatus** | boolean | A boolean flag to check the condition for the button. This property can be used to toggle the button's state, such as subscribed or unsubscribed. |
+| **buttonColor** | string | The accent color for the button. This allows you to set a custom color that matches your brand's theme. |
| **buttonTextColor** | string | The color of the button text. This allows you to ensure the text is visible and matches your desired color scheme. |
+| **subscribeStatus** | boolean | A boolean flag to check the condition for the button. This property can be used to toggle the button's state, such as subscribed or unsubscribed. |
| **initialText** | string | The initial text displayed on the button. This is useful for setting a default label when the button first appears. |
| **changeText** | string | The final text displayed on the button after an action has been taken. This can be used to indicate a state change, such as from "Subscribe" to "Subscribed". |
diff --git a/registry/components/example/animated-subscribe-button-demo.tsx b/registry/components/example/animated-subscribe-button-demo.tsx
index 93d6ae44..d0947126 100644
--- a/registry/components/example/animated-subscribe-button-demo.tsx
+++ b/registry/components/example/animated-subscribe-button-demo.tsx
@@ -4,9 +4,9 @@ import { CheckIcon, ChevronRightIcon } from "lucide-react";
export default function AnimatedSubscribeButtonDemo() {
return (
<AnimatedSubscribeButton
- brand="#ffbd7a"
+ buttonColor="#000000"
+ buttonTextColor="#ffffff"
subscribeStatus={false}
- buttonTextColor="#000009"
initialText={
<span className="group inline-flex items-center">
Subscribe{" "}
diff --git a/registry/components/magicui/animated-subscribe-button.tsx b/registry/components/magicui/animated-subscribe-button.tsx
index f0d9dde4..236554fe 100644
--- a/registry/components/magicui/animated-subscribe-button.tsx
+++ b/registry/components/magicui/animated-subscribe-button.tsx
@@ -4,23 +4,29 @@ import { AnimatePresence, motion } from "framer-motion";
import React, { useState } from "react";
interface AnimatedSubscribeButtonProps {
- brand: string;
- subscribeStatus: boolean;
+ buttonColor: string;
buttonTextColor?: string;
+ subscribeStatus: boolean;
initialText: React.ReactElement | string;
changeText: React.ReactElement | string;
}
export const AnimatedSubscribeButton: React.FC<
AnimatedSubscribeButtonProps
-> = ({ brand, subscribeStatus, buttonTextColor, changeText, initialText }) => {
+> = ({
+ buttonColor,
+ subscribeStatus,
+ buttonTextColor,
+ changeText,
+ initialText,
+}) => {
const [isSubscribed, setIsSubscribed] = useState<boolean>(subscribeStatus);
return (
<AnimatePresence mode="wait">
{isSubscribed ? (
<motion.button
- className="relative flex w-[200px] items-center justify-center bg-white p-[10px]"
+ className="relative flex w-[200px] items-center justify-center overflow-hidden rounded-md bg-white p-[10px] outline outline-1 outline-black"
onClick={() => setIsSubscribed(false)}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
@@ -31,7 +37,7 @@ export const AnimatedSubscribeButton: React.FC<
className="relative block h-full w-full font-semibold"
initial={{ y: -50 }}
animate={{ y: 0 }}
- style={{ color: brand }}
+ style={{ color: buttonColor }}
>
{changeText}
</motion.span>
@@ -39,7 +45,7 @@ export const AnimatedSubscribeButton: React.FC<
) : (
<motion.button
className="relative flex w-[200px] cursor-pointer items-center justify-center rounded-md border-none p-[10px]"
- style={{ backgroundColor: brand, color: buttonTextColor }}
+ style={{ backgroundColor: buttonColor, color: buttonTextColor }}
onClick={() => setIsSubscribed(true)}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}