Skip to content

Commit

Permalink
Merge pull request #62 from ComputerSocietyVITC/experimental
Browse files Browse the repository at this point in the history
Add border effects on buttons
  • Loading branch information
a2ys authored Aug 11, 2024
2 parents 7015820 + e85f784 commit 46cecb5
Show file tree
Hide file tree
Showing 30 changed files with 168 additions and 15 deletions.
Binary file removed public/bitwars.jpg
Binary file not shown.
Binary file added public/bitwars.webp
Binary file not shown.
Binary file removed public/bitwarsLogo.png
Binary file not shown.
Binary file added public/bitwarsLogo.webp
Binary file not shown.
Binary file removed public/compsoc.png
Binary file not shown.
Binary file added public/compsoc.webp
Binary file not shown.
Binary file removed public/favicon_icon/android-chrome-192x192.png
Binary file not shown.
Binary file added public/favicon_icon/android-chrome-192x192.webp
Binary file not shown.
Binary file removed public/favicon_icon/android-chrome-512x512.png
Binary file not shown.
Binary file added public/favicon_icon/android-chrome-512x512.webp
Binary file not shown.
Binary file removed public/favicon_icon/apple-touch-icon.png
Binary file not shown.
Binary file added public/favicon_icon/apple-touch-icon.webp
Binary file not shown.
Binary file removed public/favicon_icon/favicon-16x16.png
Binary file not shown.
Binary file added public/favicon_icon/favicon-16x16.webp
Binary file not shown.
Binary file removed public/favicon_icon/favicon-32x32.png
Binary file not shown.
Binary file added public/favicon_icon/favicon-32x32.webp
Binary file not shown.
4 changes: 2 additions & 2 deletions public/favicon_icon/site.webmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"short_name": "Bitwars",
"icons": [
{
"src": "/android-chrome-192x192.png",
"src": "/android-chrome-192x192.webp",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"src": "/android-chrome-512x512.webp",
"sizes": "512x512",
"type": "image/png"
}
Expand Down
Binary file removed public/logo.png
Binary file not shown.
Binary file added public/logo.webp
Binary file not shown.
Binary file removed public/oc.jpg
Binary file not shown.
Binary file added public/oc.webp
Binary file not shown.
Binary file removed public/swc.png
Binary file not shown.
Binary file added public/swc.webp
Binary file not shown.
4 changes: 4 additions & 0 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,7 @@ body {
padding: 3px;
box-sizing: border-box;
}

.button-gradient {
background: radial-gradient(rgb(56 189 248) 40%, transparent 60%);
}
8 changes: 6 additions & 2 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Main from "@/pages/main";
import Showcase from "@/pages/showcase";
import Aboutus from "@/pages/aboutus";
import Image from "next/image";
import { Button } from "@/components/ui/moving-border";

const montserrat = Montserrat({ subsets: ["latin"] });

Expand Down Expand Up @@ -52,14 +53,17 @@ export default function Home() {
target="_blank"
rel="noopener noreferrer"
>
<div className="sm:scale-[70%] border border-white/[0.2] flex flex-col items-center justify-end py-8 rounded-full px-12 cursor-pointer hover:scale-[105%] sm:hover:scale-[90%] transition duration-300 bg-gradient-to-b from-[#130f1f] to-[#001c4fe5]">
<Button
borderRadius="9999px"
className="sm:scale-[70%] border border-white/[0.2] flex flex-col items-center justify-end py-8 px-12 cursor-pointer hover:scale-[103%] sm:hover:scale-[90%] transition duration-300"
>
<section className="text-3xl font-light pt-4 text-center">
INTERESTED IN SPONSORING US?
</section>
<section className="text-3xl pt-4 font-bold sm:text-xl">
CLICK HERE
</section>
</div>
</Button>
</a>
</section>
</section>
Expand Down
2 changes: 1 addition & 1 deletion src/components/footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const Footer = () => {
<div className="flex flex-col md:flex-row lg:flex-row justify-center">
{/* IEEE logo */}
<div className="flex items-center justify-center basis-1/5">
<Image src="/compsoc.png" alt="logo2" width={280} height={80} />
<Image src="/compsoc.webp" alt="logo2" width={280} height={80} />
</div>

{/* Menu */}
Expand Down
139 changes: 139 additions & 0 deletions src/components/ui/moving-border.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
"use client";
import React from "react";
import {
motion,
useAnimationFrame,
useMotionTemplate,
useMotionValue,
useTransform,
} from "framer-motion";
import { useRef } from "react";
import { cn } from "@/lib/utils";

export function Button({
borderRadius = "1.75rem",
children,
as: Component = "button",
containerClassName,
borderClassName,
duration,
className,
...otherProps
}: {
borderRadius?: string;
children: React.ReactNode;
as?: any;
containerClassName?: string;
borderClassName?: string;
duration?: number;
className?: string;
[key: string]: any;
}) {
return (
<Component
className={cn(
"bg-transparent relative text-xl p-0.5 rounded-full overflow-hidden ",
containerClassName
)}
style={{
borderRadius: borderRadius,
}}
{...otherProps}
>
<div
className="absolute inset-0"
style={{ borderRadius: `calc(${borderRadius} * 0.96)` }}
>
<MovingBorder duration={duration} rx="30%" ry="30%">
<div
className={cn(
"h-20 w-20 opacity-[0.8] button-gradient",
borderClassName
)}
/>
</MovingBorder>
</div>

<div
className={cn(
"relative bg-slate-900/[0.8] border border-slate-800 backdrop-blur-xl text-white flex items-center justify-center w-full h-full text-sm antialiased",
className
)}
style={{
borderRadius: `calc(${borderRadius} * 0.96)`,
}}
>
{children}
</div>
</Component>
);
}

export const MovingBorder = ({
children,
duration = 2000,
rx,
ry,
...otherProps
}: {
children: React.ReactNode;
duration?: number;
rx?: string;
ry?: string;
[key: string]: any;
}) => {
const pathRef = useRef<any>();
const progress = useMotionValue<number>(0);

useAnimationFrame((time) => {
const length = pathRef.current?.getTotalLength();
if (length) {
const pxPerMillisecond = length / duration;
progress.set((time * pxPerMillisecond) % length);
}
});

const x = useTransform(
progress,
(val) => pathRef.current?.getPointAtLength(val).x
);
const y = useTransform(
progress,
(val) => pathRef.current?.getPointAtLength(val).y
);

const transform = useMotionTemplate`translateX(${x}px) translateY(${y}px) translateX(-50%) translateY(-50%)`;

return (
<>
<svg
xmlns="http://www.w3.org/2000/svg"
preserveAspectRatio="none"
className="absolute h-full w-full"
width="100%"
height="100%"
{...otherProps}
>
<rect
fill="none"
width="100%"
height="100%"
rx={rx}
ry={ry}
ref={pathRef}
/>
</svg>
<motion.div
style={{
position: "absolute",
top: 0,
left: 0,
display: "inline-block",
transform,
}}
>
{children}
</motion.div>
</>
);
};
4 changes: 2 additions & 2 deletions src/pages/aboutus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Aboutus = () => {
alt=""
height={500}
width={600}
src="/oc.jpg"
src="/oc.webp"
className="w-full px-8 rounded-3xl object-contain hidden sm:block pt-8"
/>
<p className="text-white text-justify py-12 px-8 md:text-sm">
Expand All @@ -29,7 +29,7 @@ const Aboutus = () => {
alt=""
height={500}
width={600}
src="/oc.jpg"
src="/oc.webp"
className="w-[35vw] rounded-xl object-contain sm:hidden"
/>
</div>
Expand Down
12 changes: 8 additions & 4 deletions src/pages/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";
import Image from "next/image";
import Timer from "@/components/timer/Timer";
import Link from "next/link";
import { Button } from "@/components/ui/moving-border";

const Main: React.FC = () => {
return (
Expand All @@ -15,7 +16,7 @@ const Main: React.FC = () => {
className="object-contain h-[7vh] w-full sm:w-28"
/>
<Image
src="/compsoc.png"
src="/compsoc.webp"
width={150}
height={100}
alt=""
Expand All @@ -33,7 +34,7 @@ const Main: React.FC = () => {
<div className="flex items-center ">
<div className=" mx-auto w-4/5 flex flex-col" id="home">
<Image
src="/bitwarsLogo.png"
src="/bitwarsLogo.webp"
alt="logo"
height={500}
width={500}
Expand All @@ -51,9 +52,12 @@ const Main: React.FC = () => {
<section>VIT Chennai</section>
</section>
<Link href="https://unstop.com/p/bitwars-20-vit-chennai-1100706">
<section className="rounded-full bg-blue-100 font-normal sm:text-lg px-8 py-2 text-2xl text-blue-950 hover:scale-[95%] scale-[90%] transition duration-300">
<Button
borderRadius="9999px"
className="bg-white dark:bg-slate-900 text-black dark:text-white border-neutral-200 dark:border-slate-800 py-4 px-8 font-medium sm:text-lg text-2xl hover:scale-[103%] transition duration-300"
>
Register Here →
</section>
</Button>
</Link>
</section>
</section>
Expand Down
10 changes: 6 additions & 4 deletions src/pages/showcase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ const Showcase = () => {
alt=""
height={500}
width={600}
src="/bitwars.jpg"
src="/bitwars.webp"
className="w-[35vw] rounded-xl object-contain sm:hidden"
/>
<div className="shadow-md shadow-[#292761] flex flex-col items-center w-full rounded-2xl text-center bg-gradient-to-br from-[#100e1773] via-[#10345676] to-[#100e177e] border border-white/[0.2] lg:px-12 px-8 py-12">
<Image
alt=""
height={500}
width={600}
src="/bitwars.jpg"
src="/bitwars.webp"
className="w-full px-8 sm:px-0 rounded-3xl object-contain hidden sm:block pt-8"
/>
<p className="text-white text-justify md:text-sm my-8 ">
<p className="text-white text-justify md:text-sm my-8">
BITWARS 2.0, VIT Chennai&apos;s second edition of the biggest
offline Competitive Programming Event, is set to revolutionize
Competitive Programming Culture. Hosted by IEEE CS, it features
Expand All @@ -35,7 +35,9 @@ const Showcase = () => {
problems. Join us for a transformative experience.
</p>
<section className="text-white text-start border border-slate-500 rounded-2xl p-4 md:text-sm">
<section className="font-semibold md:text-lg">Overview</section>
<section className="font-semibold md:text-lg pb-1">
Overview
</section>
<section className="italic">
- Competitive coding event where participants competed for the
top title Challenged participants&apos; coding skills and
Expand Down

0 comments on commit 46cecb5

Please sign in to comment.