Skip to content

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

fix: update shine border example in light mode

Dillion Vermaa74b5996067e
diff --git a/content/docs/components/shine-border.mdx b/content/docs/components/shine-border.mdx
index ddc39317..8421bd3b 100644
--- a/content/docs/components/shine-border.mdx
+++ b/content/docs/components/shine-border.mdx
@@ -108,14 +108,14 @@ module.exports = {
## Props
-| Prop | Type | Description | Default |
-| ------------ | ------------------------------ | ------------------------------------------------------------------- | ---------- |
-| className | string | The class name to be applied to the component. | |
-| duration | number | Defines the animation duration to be applied on the shining border. | 14 seconds |
-| color | `#${string}` OR `#${string}`[] | A string or string array to define border color. | #FFFFFF |
-| borderRadius | number | Defines the radius of the border. | 8px |
-| borderWidth | number | Defines the width of the border. | 1px |
-| children | ReactNode | Contains react node elements. | {} |
+| Prop | Type | Description | Default |
+| ------------ | --------- | ------------------------------------------------------------------- | ---------- |
+| className | string | The class name to be applied to the component. | |
+| duration | number | Defines the animation duration to be applied on the shining border. | 14 seconds |
+| color | string | Defines the color of the border. | #FFFFFF |
+| borderRadius | number | Defines the radius of the border. | 8px |
+| borderWidth | number | Defines the width of the border. | 1px |
+| children | ReactNode | Contains react node elements. | {} |
## Credits
diff --git a/registry/components/example/shine-border-demo-2.tsx b/registry/components/example/shine-border-demo-2.tsx
index bc7645f9..8d2c3807 100644
--- a/registry/components/example/shine-border-demo-2.tsx
+++ b/registry/components/example/shine-border-demo-2.tsx
@@ -1,8 +1,14 @@
+import { useTheme } from "next-themes";
+
import ShineBorder from "@/components/magicui/shine-border";
export default function ShineBorderDemo() {
+ const theme = useTheme();
return (
- <ShineBorder className="text-center text-2xl font-bold capitalize">
+ <ShineBorder
+ className="text-center text-2xl font-bold capitalize"
+ color={theme.theme === "dark" ? "white" : "black"}
+ >
Shine Border
</ShineBorder>
);
diff --git a/registry/components/magicui/shine-border.tsx b/registry/components/magicui/shine-border.tsx
index 2589398b..08dd41f2 100644
--- a/registry/components/magicui/shine-border.tsx
+++ b/registry/components/magicui/shine-border.tsx
@@ -2,7 +2,8 @@
import { cn } from "@/lib/utils";
-type TColorProp = `#${string}` | `#${string}`[];
+type TColorProp = string | string[];
+
interface ShineBorderProps {
borderRadius?: number;
borderWidth?: number;
@@ -26,7 +27,7 @@ export default function ShineBorder({
borderRadius = 8,
borderWidth = 1,
duration = 14,
- color = "#fff",
+ color = "#000000",
className,
children,
}: ShineBorderProps) {
@@ -38,7 +39,7 @@ export default function ShineBorder({
} as React.CSSProperties
}
className={cn(
- "relative grid min-h-[60px] w-fit min-w-[300px] place-items-center rounded-[--border-radius] bg-white p-3 text-black dark:bg-black dark:text-white",
+ "relative grid min-h-[60px] w-fit min-w-[300px] place-items-center rounded-[--border-radius] bg-white p-3 text-black dark:bg-black dark:text-white",
className,
)}
>
@@ -50,12 +51,12 @@ export default function ShineBorder({
"--border-radius-child": `${borderRadius * 0.2}px`,
"--shine-pulse-duration": `${duration}s`,
"--mask-linear-gradient": `linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)`,
- "--background-radial-gradient": `radial-gradient(transparent,transparent, ${!(color instanceof Array) ? color : color.join(",")},transparent,transparent)`,
+ "--background-radial-gradient": `radial-gradient(transparent,transparent, ${color instanceof Array ? color.join(",") : color},transparent,transparent)`,
} as React.CSSProperties
}
- className={`before:bg-shine-size before:absolute before:inset-[0] before:aspect-square before:h-full before:w-full before:rounded-[--border-radius] before:p-[--border-width] before:will-change-[background-position] before:content-[""] before:![-webkit-mask-composite:xor] before:![mask-composite:exclude] before:[background-image:var(--background-radial-gradient)] before:[background-size:300%_300%] before:[mask:var(--mask-linear-gradient)] motion-safe:before:animate-[shine-pulse_var(--shine-pulse-duration)_infinite_linear]`}
+ className={`before:bg-shine-size before:absolute before:inset-0 before:aspect-square before:size-full before:rounded-[--border-radius] before:p-[--border-width] before:will-change-[background-position] before:content-[""] before:![-webkit-mask-composite:xor] before:![mask-composite:exclude] before:[background-image:--background-radial-gradient] before:[background-size:300%_300%] before:[mask:--mask-linear-gradient] motion-safe:before:animate-[shine-pulse_var(--shine-pulse-duration)_infinite_linear]`}
></div>
- <div className={"z-[1] h-full w-full rounded-[--border-radius-child]"}>
+ <div className={"z-[1] size-full rounded-[--border-radius-child]"}>
{children}
</div>
</div>