-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #591 from 1chooo/v0.5.1
V0.5.1
- Loading branch information
Showing
12 changed files
with
280 additions
and
52 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,23 @@ | ||
import type { Metadata } from "next"; | ||
import PageHeader from '@/components/page-header'; | ||
import config from '@/config'; | ||
import { BlurFadeDemo } from "@/components/magicui/blur-fade-demo"; | ||
import { AnimatedGradientTextDemo } from "@/components/magicui/animated-gradient-text-demo"; | ||
|
||
const { title } = config; | ||
|
||
export const metadata: Metadata = { | ||
title: `Gallery | ${title}`, | ||
}; | ||
|
||
const Gallery = async () => { | ||
return ( | ||
<article> | ||
<PageHeader header="Hugo's Gallery" /> | ||
<BlurFadeDemo /> | ||
<AnimatedGradientTextDemo /> | ||
</article> | ||
); | ||
}; | ||
|
||
export default Gallery; |
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
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
apps/web/src/components/magicui/animated-gradient-text-demo.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,30 @@ | ||
import { ChevronRight } from "lucide-react"; | ||
import Link from "next/link"; | ||
|
||
import { cn } from "@/lib/utils"; | ||
import AnimatedGradientText from "@/components/magicui/animated-gradient-text"; | ||
|
||
export async function AnimatedGradientTextDemo() { | ||
return ( | ||
<div className="z-10 flex items-center justify-center mt-5"> | ||
<Link | ||
href="https://magicui.design/" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
<AnimatedGradientText> | ||
🎉 <hr className="mx-2 h-4 w-px shrink-0 bg-gray-300" />{" "} | ||
<span | ||
className={cn( | ||
`inline animate-gradient bg-gradient-to-r from-[#ffaa40] via-[#9c40ff] to-[#ffaa40] bg-[length:var(--bg-size)_100%] bg-clip-text text-transparent`, | ||
)} | ||
> | ||
Thanks for Magic UI! | ||
</span> | ||
|
||
<ChevronRight className="ml-1 size-3 transition-transform duration-300 ease-in-out group-hover:translate-x-0.5" /> | ||
</AnimatedGradientText> | ||
</Link> | ||
</div> | ||
); | ||
} |
26 changes: 26 additions & 0 deletions
26
apps/web/src/components/magicui/animated-gradient-text.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,26 @@ | ||
import { ReactNode } from "react"; | ||
|
||
import { cn } from "@/lib/utils"; | ||
|
||
export default function AnimatedGradientText({ | ||
children, | ||
className, | ||
}: { | ||
children: ReactNode; | ||
className?: string; | ||
}) { | ||
return ( | ||
<div | ||
className={cn( | ||
"group relative mx-auto flex max-w-fit flex-row items-center justify-center rounded-2xl bg-white/40 px-4 py-1.5 text-sm font-medium shadow-[inset_0_-8px_10px_#8fdfff1f] backdrop-blur-sm transition-shadow duration-500 ease-out [--bg-size:300%] hover:shadow-[inset_0_-5px_10px_#8fdfff3f] dark:bg-black/40", | ||
className, | ||
)} | ||
> | ||
<div | ||
className={`absolute inset-0 block h-full w-full animate-gradient bg-gradient-to-r from-[#ffaa40]/50 via-[#9c40ff]/50 to-[#ffaa40]/50 bg-[length:var(--bg-size)_100%] p-[1px] ![mask-composite:subtract] [border-radius:inherit] [mask:linear-gradient(#fff_0_0)_content-box,linear-gradient(#fff_0_0)]`} | ||
/> | ||
|
||
{children} | ||
</div> | ||
); | ||
} |
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,43 @@ | ||
import { CSSProperties, FC, ReactNode } from "react"; | ||
|
||
import { cn } from "@/lib/utils"; | ||
|
||
interface AnimatedShinyTextProps { | ||
children: ReactNode; | ||
className?: string; | ||
shimmerWidth?: number; | ||
} | ||
|
||
/** | ||
* @link https://magicui.design/docs/components/animated-shiny-text | ||
*/ | ||
const AnimatedShinyText: FC<AnimatedShinyTextProps> = ({ | ||
children, | ||
className, | ||
shimmerWidth = 100, | ||
}) => { | ||
return ( | ||
<p | ||
style={ | ||
{ | ||
"--shiny-width": `${shimmerWidth}px`, | ||
} as CSSProperties | ||
} | ||
className={cn( | ||
"mx-auto max-w-md text-neutral-600/70 dark:text-neutral-400/70", | ||
|
||
// Shine effect | ||
"animate-shiny-text bg-clip-text bg-no-repeat [background-position:0_0] [background-size:var(--shiny-width)_100%] [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]", | ||
|
||
// Shine gradient | ||
"bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80", | ||
|
||
className, | ||
)} | ||
> | ||
{children} | ||
</p> | ||
); | ||
}; | ||
|
||
export default AnimatedShinyText; |
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,26 @@ | ||
import BlurFade from "@/components/magicui/blur-fade"; | ||
|
||
const images = Array.from({ length: 9 }, (_, i) => { | ||
const isLandscape = i % 2 === 0; | ||
const width = isLandscape ? 800 : 600; | ||
const height = isLandscape ? 600 : 800; | ||
return `https://picsum.photos/seed/${i + 1}/${width}/${height}`; | ||
}); | ||
|
||
export function BlurFadeDemo() { | ||
return ( | ||
<section id="photos"> | ||
<div className="columns-2 gap-4 sm:columns-3"> | ||
{images.map((imageUrl, idx) => ( | ||
<BlurFade key={imageUrl} delay={0.25 + idx * 0.05} inView> | ||
<img | ||
className="mb-4 size-full rounded-lg object-contain" | ||
src={imageUrl} | ||
alt={`Random stock image ${idx + 1}`} | ||
/> | ||
</BlurFade> | ||
))} | ||
</div> | ||
</section> | ||
); | ||
} |
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,83 @@ | ||
"use client"; | ||
|
||
import { useRef } from "react"; | ||
import { | ||
AnimatePresence, | ||
motion, | ||
useInView, | ||
UseInViewOptions, | ||
Variants, | ||
} from "framer-motion"; | ||
|
||
type MarginType = UseInViewOptions["margin"]; | ||
|
||
interface BlurFadeProps { | ||
children: React.ReactNode; | ||
className?: string; | ||
variant?: { | ||
hidden: { y: number }; | ||
visible: { y: number }; | ||
}; | ||
duration?: number; | ||
delay?: number; | ||
yOffset?: number; | ||
inView?: boolean; | ||
inViewMargin?: MarginType; | ||
blur?: string; | ||
} | ||
|
||
/** | ||
* @example | ||
* <section id="header"> | ||
* <BlurFade delay={0.25} inView> | ||
* <h2 className="text-3xl font-bold tracking-tighter sm:text-5xl xl:text-6xl/none"> | ||
* Hello World 👋 | ||
* </h2> | ||
* </BlurFade> | ||
* <BlurFade delay={0.25 * 2} inView> | ||
* <span className="text-xl text-pretty tracking-tighter sm:text-3xl xl:text-4xl/none"> | ||
* Nice to meet you | ||
* </span> | ||
* </BlurFade> | ||
* </section> | ||
*/ | ||
|
||
export default function BlurFade({ | ||
children, | ||
className, | ||
variant, | ||
duration = 0.4, | ||
delay = 0, | ||
yOffset = 6, | ||
inView = false, | ||
inViewMargin = "-50px", | ||
blur = "6px", | ||
}: BlurFadeProps) { | ||
const ref = useRef(null); | ||
const inViewResult = useInView(ref, { once: true, margin: inViewMargin }); | ||
const isInView = !inView || inViewResult; | ||
const defaultVariants: Variants = { | ||
hidden: { y: yOffset, opacity: 0, filter: `blur(${blur})` }, | ||
visible: { y: -yOffset, opacity: 1, filter: `blur(0px)` }, | ||
}; | ||
const combinedVariants = variant || defaultVariants; | ||
return ( | ||
<AnimatePresence> | ||
<motion.div | ||
ref={ref} | ||
initial="hidden" | ||
animate={isInView ? "visible" : "hidden"} | ||
exit="hidden" | ||
variants={combinedVariants} | ||
transition={{ | ||
delay: 0.04 + delay, | ||
duration, | ||
ease: "easeOut", | ||
}} | ||
className={className} | ||
> | ||
{children} | ||
</motion.div> | ||
</AnimatePresence> | ||
); | ||
} |
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