Skip to content

Commit

Permalink
Merge pull request #591 from 1chooo/v0.5.1
Browse files Browse the repository at this point in the history
V0.5.1
  • Loading branch information
1chooo authored Dec 6, 2024
2 parents df7882c + eab921a commit 7766e12
Show file tree
Hide file tree
Showing 12 changed files with 280 additions and 52 deletions.
4 changes: 2 additions & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "1chooo-com",
"version": "0.5.0",
"version": "0.5.1",
"private": true,
"license": "CC-BY-4.0",
"author": {
Expand Down Expand Up @@ -29,6 +29,7 @@
"@next/mdx": "^15.0.3",
"@next/third-parties": "^15.0.1",
"@primer/octicons-react": "^19.12.0",
"@radix-ui/react-icons": "^1.3.2",
"@repo/math": "*",
"@repo/ui": "*",
"@testing-library/user-event": "^14.5.2",
Expand All @@ -38,7 +39,6 @@
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
"bootstrap": "^5.3.3",
"caniuse-lite": "^1.0.30001653",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cobe": "^0.6.3",
Expand Down
23 changes: 23 additions & 0 deletions apps/web/src/app/gallery/page.tsx
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;
2 changes: 1 addition & 1 deletion apps/web/src/app/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default async function sitemap() {
'/resume',
'/portfolio',
'/post',
// '/contact'
'/gallery'
].map((route) => ({
url: `https://1chooo.com${route}`,
lastModified: new Date().toISOString().split('T')[0],
Expand Down
18 changes: 16 additions & 2 deletions apps/web/src/components/about/latest-articles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import Link from "next/link";
import Image from "next/image";
import MarkdownRenderer from "@/components/markdown/markdown-renderer";
import { sendGTMEvent } from "@/components/google";
import SeeMoreButton from "@/components/about/see-more-button";
import { LuEye } from "react-icons/lu";
import { ArrowRightIcon } from "@primer/octicons-react";
import { cn } from "@/lib/utils";
import AnimatedShinyText from "@/components/magicui/animated-shiny-text";

import "@/styles/about/latest-posts.css";

Expand Down Expand Up @@ -78,7 +79,20 @@ const LatestArticles = ({ posts }: { posts: Post[] }) => {
</li>
))}
</ul>
<SeeMoreButton badge="See More Posts" path="/post" icon={ArrowRightIcon} />
<div className="z-10 flex items-center justify-center">
<div
className={cn(
"group rounded-full border border-black/5 bg-neutral-100 text-base text-white transition-all ease-in hover:cursor-pointer hover:bg-neutral-200 dark:border-white/5 dark:bg-neutral-900 dark:hover:bg-neutral-800",
)}
>
<AnimatedShinyText className="inline-flex items-center justify-center px-4 py-1 transition ease-out hover:text-neutral-600 hover:duration-300 hover:dark:text-neutral-400">
<Link href="/post">
<span>✨ See More Posts</span>
<ArrowRightIcon className="ml-1 size-3 transition-transform duration-300 ease-in-out group-hover:translate-x-0.5 relative top-[-2px]" />
</Link>
</AnimatedShinyText>
</div>
</div>
</section>
);
};
Expand Down
47 changes: 0 additions & 47 deletions apps/web/src/components/magicui/animated-button.tsx

This file was deleted.

30 changes: 30 additions & 0 deletions apps/web/src/components/magicui/animated-gradient-text-demo.tsx
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 apps/web/src/components/magicui/animated-gradient-text.tsx
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>
);
}
43 changes: 43 additions & 0 deletions apps/web/src/components/magicui/animated-shiny-text.tsx
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;
26 changes: 26 additions & 0 deletions apps/web/src/components/magicui/blur-fade-demo.tsx
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>
);
}
83 changes: 83 additions & 0 deletions apps/web/src/components/magicui/blur-fade.tsx
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>
);
}
1 change: 1 addition & 0 deletions apps/web/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const config: Config = {
{ path: '/resume', label: 'Resume' },
{ path: '/portfolio', label: 'Portfolio' },
{ path: '/post', label: 'Post' },
{ path: '/gallery', label: 'Gallery' },
],
socialLinks: [
{ url: `https://github.com/1chooo`, icon: LuGithub, name: 'GitHub' },
Expand Down
29 changes: 29 additions & 0 deletions apps/web/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,35 @@ module.exports = {
md: `calc(var(--radius) - 2px)`,
sm: "calc(var(--radius) - 4px)",
},
animation: {
"shiny-text": "shiny-text 8s infinite",
gradient: "gradient 8s linear infinite",
marquee: "marquee var(--duration) linear infinite",
"marquee-vertical": "marquee-vertical var(--duration) linear infinite",
},
keyframes: {
"shiny-text": {
"0%, 90%, 100%": {
"background-position": "calc(-100% - var(--shiny-width)) 0",
},
"30%, 60%": {
"background-position": "calc(100% + var(--shiny-width)) 0",
},
},
gradient: {
to: {
backgroundPosition: "var(--bg-size) 0",
},
},
marquee: {
from: { transform: "translateX(0)" },
to: { transform: "translateX(calc(-100% - var(--gap)))" },
},
"marquee-vertical": {
from: { transform: "translateY(0)" },
to: { transform: "translateY(calc(-100% - var(--gap)))" },
},
},
},
},
plugins: [require("tailwindcss-animate")],
Expand Down

0 comments on commit 7766e12

Please sign in to comment.