-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Includeings aceternity ui components
- Loading branch information
1 parent
7325d6f
commit a6fe601
Showing
9 changed files
with
845 additions
and
84 deletions.
There are no files selected for viewing
95 changes: 95 additions & 0 deletions
95
ui_tailwind_shadecn/src/components/ui/container-scrool-animation.tsx
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,95 @@ | ||
// acertanity ui | ||
import React, { useRef } from "react"; | ||
import { useScroll, useTransform, motion, MotionValue } from "framer-motion"; | ||
|
||
export const ContainerScroll = ({ | ||
titleComponent, | ||
children, | ||
}: { | ||
titleComponent: string | React.ReactNode; | ||
children: React.ReactNode; | ||
}) => { | ||
const containerRef = useRef<any>(null); | ||
const { scrollYProgress } = useScroll({ | ||
target: containerRef, | ||
}); | ||
const [isMobile, setIsMobile] = React.useState(false); | ||
|
||
React.useEffect(() => { | ||
const checkMobile = () => { | ||
setIsMobile(window.innerWidth <= 768); | ||
}; | ||
checkMobile(); | ||
window.addEventListener("resize", checkMobile); | ||
return () => { | ||
window.removeEventListener("resize", checkMobile); | ||
}; | ||
}, []); | ||
|
||
const scaleDimensions = () => { | ||
return isMobile ? [0.7, 0.9] : [1.05, 1]; | ||
}; | ||
|
||
const rotate = useTransform(scrollYProgress, [0, 1], [20, 0]); | ||
const scale = useTransform(scrollYProgress, [0, 1], scaleDimensions()); | ||
const translate = useTransform(scrollYProgress, [0, 1], [0, -100]); | ||
|
||
return ( | ||
<div | ||
className="h-[50rem] flex items-center justify-center relative p-2 " | ||
ref={containerRef} | ||
> | ||
<div | ||
className="py-5 w-full relative" | ||
style={{ | ||
perspective: "1000px", | ||
}} | ||
> | ||
<Header translate={translate} titleComponent={titleComponent} /> | ||
<Card rotate={rotate} translate={translate} scale={scale}> | ||
{children} | ||
</Card> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export const Header = ({ translate, titleComponent }: any) => { | ||
return ( | ||
<motion.div | ||
style={{ | ||
translateY: translate, | ||
}} | ||
className="div max-w-5xl mx-auto text-center" | ||
> | ||
{titleComponent} | ||
</motion.div> | ||
); | ||
}; | ||
|
||
export const Card = ({ | ||
rotate, | ||
scale, | ||
children, | ||
}: { | ||
rotate: MotionValue<number>; | ||
scale: MotionValue<number>; | ||
translate: MotionValue<number>; | ||
children: React.ReactNode; | ||
}) => { | ||
return ( | ||
<motion.div | ||
style={{ | ||
rotateX: rotate, | ||
scale, | ||
boxShadow: | ||
"0 0 #0000004d, 0 9px 20px #0000004a, 0 37px 37px #00000042, 0 84px 50px #00000026, 0 149px 60px #0000000a, 0 233px 65px #00000003", | ||
}} | ||
className="max-w-5xl -mt-12 mx-auto h-[30rem] md:h-[40rem] w-full border-4 border-[#6C6C6C] p-2 md:p-6 bg-[#222222] rounded-[30px] shadow-2xl" | ||
> | ||
<div className=" h-full w-full overflow-hidden rounded-2xl bg-gray-100 dark:bg-zinc-900 md:rounded-2xl md:p-4 "> | ||
{children} | ||
</div> | ||
</motion.div> | ||
); | ||
}; |
159 changes: 159 additions & 0 deletions
159
ui_tailwind_shadecn/src/components/ui/hero-parallax.tsx
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,159 @@ | ||
// acentary ui | ||
import React from "react"; | ||
import { | ||
motion, | ||
useScroll, | ||
useTransform, | ||
useSpring, | ||
MotionValue, | ||
} from "framer-motion"; | ||
import { Link } from "react-router-dom"; | ||
|
||
|
||
export const HeroParallax = ({ | ||
products, | ||
}: { | ||
products: { | ||
title: string; | ||
link: string; | ||
thumbnail: string; | ||
}[]; | ||
}) => { | ||
const firstRow = products.slice(0, 5); | ||
const secondRow = products.slice(5, 10); | ||
const thirdRow = products.slice(10, 15); | ||
const ref = React.useRef(null); | ||
const { scrollYProgress } = useScroll({ | ||
target: ref, | ||
offset: ["start start", "end start"], | ||
}); | ||
|
||
const springConfig = { stiffness: 300, damping: 30, bounce: 100 }; | ||
|
||
const translateX = useSpring( | ||
useTransform(scrollYProgress, [0, 1], [0, 1000]), | ||
springConfig | ||
); | ||
const translateXReverse = useSpring( | ||
useTransform(scrollYProgress, [0, 1], [0, -1000]), | ||
springConfig | ||
); | ||
const rotateX = useSpring( | ||
useTransform(scrollYProgress, [0, 0.2], [15, 0]), | ||
springConfig | ||
); | ||
const opacity = useSpring( | ||
useTransform(scrollYProgress, [0, 0.2], [0.2, 1]), | ||
springConfig | ||
); | ||
const rotateZ = useSpring( | ||
useTransform(scrollYProgress, [0, 0.2], [20, 0]), | ||
springConfig | ||
); | ||
const translateY = useSpring( | ||
useTransform(scrollYProgress, [0, 0.2], [-700, 500]), | ||
springConfig | ||
); | ||
return ( | ||
<div | ||
ref={ref} | ||
className="h-[300vh] py-40 overflow-hidden antialiased relative flex flex-col self-auto [perspective:1000px] [transform-style:preserve-3d]" | ||
> | ||
<Header /> | ||
<motion.div | ||
style={{ | ||
rotateX, | ||
rotateZ, | ||
translateY, | ||
opacity, | ||
}} | ||
className="" | ||
> | ||
<motion.div className="flex flex-row-reverse space-x-reverse space-x-20 mb-20"> | ||
{firstRow.map((product) => ( | ||
<ProductCard | ||
product={product} | ||
translate={translateX} | ||
key={product.title} | ||
/> | ||
))} | ||
</motion.div> | ||
<motion.div className="flex flex-row mb-20 space-x-20 "> | ||
{secondRow.map((product) => ( | ||
<ProductCard | ||
product={product} | ||
translate={translateXReverse} | ||
key={product.title} | ||
/> | ||
))} | ||
</motion.div> | ||
<motion.div className="flex flex-row-reverse space-x-reverse space-x-20"> | ||
{thirdRow.map((product) => ( | ||
<ProductCard | ||
product={product} | ||
translate={translateX} | ||
key={product.title} | ||
/> | ||
))} | ||
</motion.div> | ||
</motion.div> | ||
</div> | ||
); | ||
}; | ||
|
||
export const Header = () => { | ||
return ( | ||
<div className="max-w-7xl relative mx-auto py-20 md:py-40 px-4 w-full left-0 top-0"> | ||
<h1 className="text-2xl md:text-7xl font-bold dark:text-white"> | ||
The Ultimate <br /> development studio | ||
</h1> | ||
<p className="max-w-2xl text-base md:text-xl mt-8 dark:text-neutral-200"> | ||
We build beautiful products with the latest technologies and frameworks. | ||
We are a team of passionate developers and designers that love to build | ||
amazing products. | ||
</p> | ||
</div> | ||
); | ||
}; | ||
|
||
export const ProductCard = ({ | ||
product, | ||
translate, | ||
}: { | ||
product: { | ||
title: string; | ||
link: string; | ||
thumbnail: string; | ||
}; | ||
translate: MotionValue<number>; | ||
}) => { | ||
return ( | ||
<motion.div | ||
style={{ | ||
x: translate, | ||
}} | ||
whileHover={{ | ||
y: -20, | ||
}} | ||
key={product.title} | ||
className="group/product h-96 w-[30rem] relative flex-shrink-0" | ||
> | ||
<Link | ||
to={product.link} | ||
className="block group-hover/product:shadow-2xl " | ||
> | ||
<img | ||
src={product.thumbnail} | ||
height="600" | ||
width="600" | ||
className="object-cover object-left-top absolute h-full w-full inset-0" | ||
alt={product.title} | ||
/> | ||
</Link> | ||
<div className="absolute inset-0 h-full w-full opacity-0 group-hover/product:opacity-80 bg-black pointer-events-none"></div> | ||
<h2 className="absolute bottom-4 left-4 opacity-0 group-hover/product:opacity-100 text-white"> | ||
{product.title} | ||
</h2> | ||
</motion.div> | ||
); | ||
}; |
119 changes: 119 additions & 0 deletions
119
ui_tailwind_shadecn/src/components/ui/infinite-moving-cards.tsx
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,119 @@ | ||
import { cn } from "@/lib/utils"; | ||
import React, { useEffect, useState } from "react"; | ||
|
||
export const InfiniteMovingCards = ({ | ||
items, | ||
direction = "left", | ||
speed = "fast", | ||
pauseOnHover = true, | ||
className, | ||
}: { | ||
items: { | ||
quote: string; | ||
name: string; | ||
title: string; | ||
}[]; | ||
direction?: "left" | "right"; | ||
speed?: "fast" | "normal" | "slow"; | ||
pauseOnHover?: boolean; | ||
className?: string; | ||
}) => { | ||
const containerRef = React.useRef<HTMLDivElement>(null); | ||
const scrollerRef = React.useRef<HTMLUListElement>(null); | ||
|
||
useEffect(() => { | ||
addAnimation(); | ||
}, []); | ||
const [start, setStart] = useState(false); | ||
function addAnimation() { | ||
if (containerRef.current && scrollerRef.current) { | ||
const scrollerContent = Array.from(scrollerRef.current.children); | ||
|
||
scrollerContent.forEach((item) => { | ||
const duplicatedItem = item.cloneNode(true); | ||
if (scrollerRef.current) { | ||
scrollerRef.current.appendChild(duplicatedItem); | ||
} | ||
}); | ||
|
||
getDirection(); | ||
getSpeed(); | ||
setStart(true); | ||
} | ||
} | ||
const getDirection = () => { | ||
if (containerRef.current) { | ||
if (direction === "left") { | ||
containerRef.current.style.setProperty( | ||
"--animation-direction", | ||
"forwards" | ||
); | ||
} else { | ||
containerRef.current.style.setProperty( | ||
"--animation-direction", | ||
"reverse" | ||
); | ||
} | ||
} | ||
}; | ||
const getSpeed = () => { | ||
if (containerRef.current) { | ||
if (speed === "fast") { | ||
containerRef.current.style.setProperty("--animation-duration", "20s"); | ||
} else if (speed === "normal") { | ||
containerRef.current.style.setProperty("--animation-duration", "40s"); | ||
} else { | ||
containerRef.current.style.setProperty("--animation-duration", "80s"); | ||
} | ||
} | ||
}; | ||
return ( | ||
<div | ||
ref={containerRef} | ||
className={cn( | ||
"scroller relative z-20 max-w-7xl overflow-hidden [mask-image:linear-gradient(to_right,transparent,white_20%,white_80%,transparent)]", | ||
className | ||
)} | ||
> | ||
<ul | ||
ref={scrollerRef} | ||
className={cn( | ||
" flex min-w-full shrink-0 gap-4 py-4 w-max flex-nowrap", | ||
start && "animate-scroll ", | ||
pauseOnHover && "hover:[animation-play-state:paused]" | ||
)} | ||
> | ||
{items.map((item, idx) => ( | ||
<li | ||
className="w-[350px] max-w-full relative rounded-2xl border border-b-0 flex-shrink-0 border-slate-700 px-8 py-6 md:w-[450px]" | ||
style={{ | ||
background: | ||
"linear-gradient(180deg, var(--slate-800), var(--slate-900)", | ||
}} | ||
key={item.name} | ||
> | ||
<blockquote> | ||
<div | ||
aria-hidden="true" | ||
className="user-select-none -z-1 pointer-events-none absolute -left-0.5 -top-0.5 h-[calc(100%_+_4px)] w-[calc(100%_+_4px)]" | ||
></div> | ||
<span className=" relative z-20 text-sm leading-[1.6] text-gray-100 font-normal"> | ||
{item.quote} | ||
</span> | ||
<div className="relative z-20 mt-6 flex flex-row items-center"> | ||
<span className="flex flex-col gap-1"> | ||
<span className=" text-sm leading-[1.6] text-gray-400 font-normal"> | ||
{item.name} | ||
</span> | ||
<span className=" text-sm leading-[1.6] text-gray-400 font-normal"> | ||
{item.title} | ||
</span> | ||
</span> | ||
</div> | ||
</blockquote> | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.