Skip to content

Commit e5317de

Browse files
committed
feat: add orbiting circles for community section on landing page
1 parent 49e1b60 commit e5317de

File tree

3 files changed

+111
-9
lines changed

3 files changed

+111
-9
lines changed

components/community.tsx

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import TwitterSvg from "@/public/images/social/twitter.svg";
77
import SlackSvg from "@/public/images/social/slack.svg";
88
import YoutubeSvg from "@/public/images/social/youtube.svg";
99
import LinkedinSvg from "@/public/images/social/linkedin.svg";
10+
import { OrbitingCircles } from "./magicui/orbitcircle";
1011
import Link from "next/link";
1112

1213
type cardSurrondStyle = {
@@ -27,6 +28,9 @@ type CardData = {
2728
svgIcon: string;
2829
platformName: string;
2930
description: string;
31+
radius: number;
32+
duration: number;
33+
delay: number;
3034
};
3135

3236
const createCircleStyles = (
@@ -59,7 +63,7 @@ function SocialLinkCard({
5963
rel="noopener noreferrer"
6064
style={showExtraStyle ? { ...style } : {}}
6165
className={`${
62-
showExtraStyle ? "circle" : "w-3/4 mx-auto mb-5"
66+
showExtraStyle ? "circle" : "w-[280px] mx-auto mb-5"
6367
} 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`}
6468
>
6569
<div className="w-12 h-12 text-center sm:mr-2">
@@ -83,30 +87,45 @@ export default function Community() {
8387
svgIcon: TwitterSvg,
8488
platformName: "Twitter",
8589
description: "Let's talk about regression testing!",
90+
radius: 300,
91+
duration: 20,
92+
delay: 1,
8693
},
8794
{
8895
link: "https://github.com/keploy/keploy",
8996
svgIcon: GithubSvg,
9097
platformName: "Github",
9198
description: "Contribute code to Keploy or report a bug",
99+
radius: 300,
100+
duration: 20,
101+
delay: 5,
92102
},
93103
{
94104
link: "https://join.slack.com/t/keploy/shared_invite/zt-2dno1yetd-Ec3el~tTwHYIHgGI0jPe7A",
95105
svgIcon: SlackSvg,
96106
platformName: "Slack",
97107
description: "Connect and chat with other Keploy users",
108+
radius: 300,
109+
duration: 20,
110+
delay: 9,
98111
},
99112
{
100113
link: "https://www.youtube.com/channel/UC6OTg7F4o0WkmNtSoob34lg",
101114
svgIcon: YoutubeSvg,
102115
platformName: "Youtube",
103116
description: "Learn with Keploy team and community videos",
117+
radius: 300,
118+
duration: 20,
119+
delay: 13,
104120
},
105121
{
106122
link: "https://www.linkedin.com/company/74471957",
107123
svgIcon: LinkedinSvg,
108124
platformName: "Linkedin",
109125
description: "Follow us and connect with other Keploy engineers!",
126+
radius: 300,
127+
duration: 20,
128+
delay: 17,
110129
},
111130
];
112131

@@ -139,21 +158,36 @@ export default function Community() {
139158
));
140159

141160
return (
142-
<section className="relative py-8 ">
161+
<section className="relative py-8">
143162
<div className="max-w-3xl mx-auto text-center">
144163
<h2 className="h2 text-secondary-300">
145164
🐰 Join the Keploy community ✨
146165
</h2>
147166
</div>
148167

149168
<div className="mx-auto w-fit">
150-
<div className="ciclegraph hidden md:block relative w-[600px] h-[600px] mx-auto mt-24 mb-24">
151-
{cardsSurround}
152-
<Image
153-
src={CommunityBunny}
154-
alt="Image"
155-
className="absolute -translate-x-1/2 -translate-y-1/2 bg-white top-1/2 left-1/2"
156-
/>
169+
<div className="relative hidden md:block m-auto h-[600px] w-[600px] mt-24 mb-24 items-center justify-center bg-background">
170+
<div>
171+
<Image src={CommunityBunny} alt="Image" className="absolute pl-5 -translate-x-1/2 translate-y-1/5 left-1/2 bg-background max-w-2xl" />
172+
</div>
173+
<div className="flex justify-center items-center">
174+
{cardsData.map((card, index) => (
175+
<OrbitingCircles
176+
key={index}
177+
className="size-[60px] border-none bg-transparent top-72 z-10"
178+
duration={card.duration}
179+
delay={card.delay}
180+
radius={card.radius}
181+
>
182+
<SocialLinkCard
183+
link={card.link}
184+
svgIcon={card.svgIcon}
185+
platformName={card.platformName}
186+
description={card.description}
187+
/>
188+
</OrbitingCircles>
189+
))}
190+
</div>
157191
</div>
158192
<div className="md:hidden">
159193
<Image src={CommunityBunny} alt="Image" className="w-3/4 mx-auto" />

components/magicui/orbitcircle.tsx

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import React from 'react'; // Ensure you have this import
2+
import { cn } from "@/lib/utils";
3+
4+
export interface OrbitingCirclesProps {
5+
className?: string;
6+
children?: React.ReactNode;
7+
reverse?: boolean;
8+
duration?: number;
9+
delay?: number;
10+
radius?: number;
11+
path?: boolean;
12+
}
13+
14+
export function OrbitingCircles({
15+
className,
16+
children,
17+
reverse,
18+
duration = 20,
19+
delay = 10,
20+
radius = 50,
21+
path = true,
22+
}: OrbitingCirclesProps) {
23+
return (
24+
<>
25+
{path && (
26+
<svg
27+
xmlns="http://www.w3.org/2000/svg"
28+
version="1.1"
29+
className="pointer-events-none absolute inset-0 size-full"
30+
>
31+
<circle
32+
className="stroke-black stroke-2 dark:stroke-black/40 invisible"
33+
cx="50%"
34+
cy="50%"
35+
r={radius}
36+
fill="none"
37+
/>
38+
</svg>
39+
)}
40+
41+
<div
42+
style={{
43+
"--duration": duration,
44+
"--radius": radius,
45+
"--delay": -delay,
46+
} as React.CSSProperties}
47+
className={cn(
48+
"absolute flex size-full transform-gpu animate-orbit items-center justify-center rounded-full border bg-black/10 [animation-delay:calc(var(--delay)*1000ms)] dark:bg-white/10",
49+
{ "[animation-direction:reverse]": reverse },
50+
className,
51+
)}
52+
>
53+
{children}
54+
</div>
55+
</>
56+
);
57+
}

tailwind.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module.exports = {
1111
marquee: "marquee var(--duration) linear infinite",
1212
"marquee-vertical": "marquee-vertical var(--duration) linear infinite",
1313
"background-position-spin": "background-position-spin 3000ms infinite alternate",
14+
orbit: "orbit calc(var(--duration)*1s) linear infinite",
1415
},
1516
keyframes: {
1617
marquee: {
@@ -25,7 +26,17 @@ module.exports = {
2526
"0%": { backgroundPosition: "top center" },
2627
"100%": { backgroundPosition: "bottom center" },
2728
},
29+
orbit: {
30+
"0%": {
31+
transform:
32+
"rotate(0deg) translateY(calc(var(--radius) * 1px)) rotate(0deg)",
33+
},
34+
"100%": {
35+
transform:
36+
"rotate(360deg) translateY(calc(var(--radius) * 1px)) rotate(-360deg)",
37+
},
2838
},
39+
},
2940
colors: {
3041
// Brand Palette
3142
// Primary headings, primary buttons, main elements

0 commit comments

Comments
 (0)