reactbits-mcp-server
Version:
MCP Server for React Bits - Access 99+ React components with animations, backgrounds, and UI elements
69 lines (67 loc) • 1.9 kB
JSX
export default function GradientText({
children,
className = "",
colors = ["#ffaa40", "#9c40ff", "#ffaa40"],
animationSpeed = 8,
showBorder = false,
}) {
const gradientStyle = {
backgroundImage: `linear-gradient(to right, ${colors.join(", ")})`,
animationDuration: `${animationSpeed}s`,
};
return (
<div
className={`relative mx-auto flex max-w-fit flex-row items-center justify-center rounded-[1.25rem] font-medium backdrop-blur transition-shadow duration-500 overflow-hidden cursor-pointer ${className}`}
>
{showBorder && (
<div
className="absolute inset-0 bg-cover z-0 pointer-events-none animate-gradient"
style={{
...gradientStyle,
backgroundSize: "300% 100%",
}}
>
<div
className="absolute inset-0 bg-black rounded-[1.25rem] z-[-1]"
style={{
width: "calc(100% - 2px)",
height: "calc(100% - 2px)",
left: "50%",
top: "50%",
transform: "translate(-50%, -50%)",
}}
></div>
</div>
)}
<div
className="inline-block relative z-2 text-transparent bg-cover animate-gradient"
style={{
...gradientStyle,
backgroundClip: "text",
WebkitBackgroundClip: "text",
backgroundSize: "300% 100%",
}}
>
{children}
</div>
</div>
);
}
// tailwind.config.js
// module.exports = {
// theme: {
// extend: {
// keyframes: {
// gradient: {
// '0%': { backgroundPosition: '0% 50%' },
// '50%': { backgroundPosition: '100% 50%' },
// '100%': { backgroundPosition: '0% 50%' },
// },
// },
// animation: {
// gradient: 'gradient 8s linear infinite'
// },
// },
// },
// plugins: [],
// };