From e5317de13e50147bdcd5f3321818bc0591398e7f Mon Sep 17 00:00:00 2001 From: techmannih Date: Wed, 9 Oct 2024 11:37:55 +0530 Subject: [PATCH] feat: add orbiting circles for community section on landing page --- components/community.tsx | 52 ++++++++++++++++++++++----- components/magicui/orbitcircle.tsx | 57 ++++++++++++++++++++++++++++++ tailwind.config.js | 11 ++++++ 3 files changed, 111 insertions(+), 9 deletions(-) create mode 100644 components/magicui/orbitcircle.tsx diff --git a/components/community.tsx b/components/community.tsx index 051f2ea5..953ca4e6 100644 --- a/components/community.tsx +++ b/components/community.tsx @@ -7,6 +7,7 @@ import TwitterSvg from "@/public/images/social/twitter.svg"; import SlackSvg from "@/public/images/social/slack.svg"; import YoutubeSvg from "@/public/images/social/youtube.svg"; import LinkedinSvg from "@/public/images/social/linkedin.svg"; +import { OrbitingCircles } from "./magicui/orbitcircle"; import Link from "next/link"; type cardSurrondStyle = { @@ -27,6 +28,9 @@ type CardData = { svgIcon: string; platformName: string; description: string; + radius: number; + duration: number; + delay: number; }; const createCircleStyles = ( @@ -59,7 +63,7 @@ function SocialLinkCard({ rel="noopener noreferrer" style={showExtraStyle ? { ...style } : {}} className={`${ - showExtraStyle ? "circle" : "w-3/4 mx-auto mb-5" + showExtraStyle ? "circle" : "w-[280px] mx-auto mb-5" } z-10 bg-white shadow-md rounded-lg border border-accent-500 p-4 hover:shadow-xl flex items-center justify-start group transition duration-300`} >
@@ -83,30 +87,45 @@ export default function Community() { svgIcon: TwitterSvg, platformName: "Twitter", description: "Let's talk about regression testing!", + radius: 300, + duration: 20, + delay: 1, }, { link: "https://github.com/keploy/keploy", svgIcon: GithubSvg, platformName: "Github", description: "Contribute code to Keploy or report a bug", + radius: 300, + duration: 20, + delay: 5, }, { link: "https://join.slack.com/t/keploy/shared_invite/zt-2dno1yetd-Ec3el~tTwHYIHgGI0jPe7A", svgIcon: SlackSvg, platformName: "Slack", description: "Connect and chat with other Keploy users", + radius: 300, + duration: 20, + delay: 9, }, { link: "https://www.youtube.com/channel/UC6OTg7F4o0WkmNtSoob34lg", svgIcon: YoutubeSvg, platformName: "Youtube", description: "Learn with Keploy team and community videos", + radius: 300, + duration: 20, + delay: 13, }, { link: "https://www.linkedin.com/company/74471957", svgIcon: LinkedinSvg, platformName: "Linkedin", description: "Follow us and connect with other Keploy engineers!", + radius: 300, + duration: 20, + delay: 17, }, ]; @@ -139,7 +158,7 @@ export default function Community() { )); return ( -
+

🐰 Join the Keploy community ✨ @@ -147,13 +166,28 @@ export default function Community() {

-
- {cardsSurround} - Image +
+
+ Image +
+
+ {cardsData.map((card, index) => ( + + + + ))} +
Image diff --git a/components/magicui/orbitcircle.tsx b/components/magicui/orbitcircle.tsx new file mode 100644 index 00000000..4bcf1e6c --- /dev/null +++ b/components/magicui/orbitcircle.tsx @@ -0,0 +1,57 @@ +import React from 'react'; // Ensure you have this import +import { cn } from "@/lib/utils"; + +export interface OrbitingCirclesProps { + className?: string; + children?: React.ReactNode; + reverse?: boolean; + duration?: number; + delay?: number; + radius?: number; + path?: boolean; +} + +export function OrbitingCircles({ + className, + children, + reverse, + duration = 20, + delay = 10, + radius = 50, + path = true, +}: OrbitingCirclesProps) { + return ( + <> + {path && ( + + + + )} + +
+ {children} +
+ + ); +} diff --git a/tailwind.config.js b/tailwind.config.js index 3a89ec0a..60f9e429 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -11,6 +11,7 @@ module.exports = { marquee: "marquee var(--duration) linear infinite", "marquee-vertical": "marquee-vertical var(--duration) linear infinite", "background-position-spin": "background-position-spin 3000ms infinite alternate", + orbit: "orbit calc(var(--duration)*1s) linear infinite", }, keyframes: { marquee: { @@ -25,7 +26,17 @@ module.exports = { "0%": { backgroundPosition: "top center" }, "100%": { backgroundPosition: "bottom center" }, }, + orbit: { + "0%": { + transform: + "rotate(0deg) translateY(calc(var(--radius) * 1px)) rotate(0deg)", + }, + "100%": { + transform: + "rotate(360deg) translateY(calc(var(--radius) * 1px)) rotate(-360deg)", + }, }, + }, colors: { // Brand Palette // Primary headings, primary buttons, main elements