This repository has been archived by the owner on May 14, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
123 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { cn } from "@/components/cn"; | ||
import React from "react"; | ||
import { motion } from "framer-motion"; | ||
|
||
export const BackgroundGradient = ({ | ||
children, | ||
className, | ||
containerClassName, | ||
animate = true, | ||
}: { | ||
children?: React.ReactNode; | ||
className?: string; | ||
containerClassName?: string; | ||
animate?: boolean; | ||
}) => { | ||
const variants = { | ||
initial: { | ||
backgroundPosition: "0 50%", | ||
}, | ||
animate: { | ||
backgroundPosition: ["0, 50%", "100% 50%", "0 50%"], | ||
}, | ||
}; | ||
return ( | ||
<div className={cn("relative p-[4px] group", containerClassName)}> | ||
<motion.div | ||
variants={animate ? variants : undefined} | ||
initial={animate ? "initial" : undefined} | ||
animate={animate ? "animate" : undefined} | ||
transition={ | ||
animate | ||
? { | ||
duration: 5, | ||
repeat: Infinity, | ||
repeatType: "reverse", | ||
} | ||
: undefined | ||
} | ||
style={{ | ||
backgroundSize: animate ? "400% 400%" : undefined, | ||
}} | ||
className={cn( | ||
"absolute inset-0 rounded-3xl z-[1] opacity-60 group-hover:opacity-100 blur-xl transition duration-500 will-change-transform", | ||
" bg-[radial-gradient(circle_farthest-side_at_0_100%,#00ccb1,transparent),radial-gradient(circle_farthest-side_at_100%_0,#7b61ff,transparent),radial-gradient(circle_farthest-side_at_100%_100%,#ffc414,transparent),radial-gradient(circle_farthest-side_at_0_0,#1ca0fb,#141316)]" | ||
)} | ||
/> | ||
<motion.div | ||
variants={animate ? variants : undefined} | ||
initial={animate ? "initial" : undefined} | ||
animate={animate ? "animate" : undefined} | ||
transition={ | ||
animate | ||
? { | ||
duration: 5, | ||
repeat: Infinity, | ||
repeatType: "reverse", | ||
} | ||
: undefined | ||
} | ||
style={{ | ||
backgroundSize: animate ? "400% 400%" : undefined, | ||
}} | ||
className={cn( | ||
"absolute inset-0 rounded-3xl z-[1] will-change-transform", | ||
"bg-[radial-gradient(circle_farthest-side_at_0_100%,#00ccb1,transparent),radial-gradient(circle_farthest-side_at_100%_0,#7b61ff,transparent),radial-gradient(circle_farthest-side_at_100%_100%,#ffc414,transparent),radial-gradient(circle_farthest-side_at_0_0,#1ca0fb,#141316)]" | ||
)} | ||
/> | ||
|
||
<div className={cn("relative z-10", className)}>{children}</div> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.
cbeb4ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
web-new – ./
team334.vercel.app
bths.vercel.app
web-new-techknights.vercel.app
techknights.vercel.app
web-new-git-main-techknights.vercel.app
bthsrobotics.vercel.app