mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-22 16:10:40 +07:00
feat(ui): v3 enhancements - hero photo, particles, mobile responsive
- Hero photo: circular shape, object-position center top, transparent background - Hero particles: bigger (6-16px), more visible (opacity 0.8) - Mobile: hide hero photo, transparent hero content, fix text/social link colors - Mobile social links: darker border in light mode - Update spec docs and all section components for v3 UI
This commit is contained in:
1 parent
a303d98e41
commit
dd22f3be3a
26 files changed
+810
-504
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import { motion } from "motion/react"
|
||||
import { InView } from "@/components/ui/InView"
|
||||
import type { ReactNode } from "react"
|
||||
|
||||
interface AnimatedSectionProps {
|
||||
direction?: "up" | "right" | "left"
|
||||
delay?: number
|
||||
children: ReactNode
|
||||
}
|
||||
|
||||
function getDirection(direction: 'up' | 'right' | 'left') {
|
||||
switch (direction) {
|
||||
case 'up': return { y: [40, 0], opacity: [0, 1] }
|
||||
case 'right': return { x: [-40, 0], opacity: [0, 1] }
|
||||
case 'left': return { x: [40, 0], opacity: [0, 1] }
|
||||
}
|
||||
}
|
||||
|
||||
export function AnimatedSection({
|
||||
direction = "up",
|
||||
delay = 0,
|
||||
children,
|
||||
}: AnimatedSectionProps) {
|
||||
const { y, opacity } = getDirection(direction)
|
||||
return (
|
||||
<InView>
|
||||
<motion.div
|
||||
initial={{ y, opacity }}
|
||||
whileInView={{ y: 0, opacity: 1 }}
|
||||
viewport={{ once: true, margin: "0px 0px -50px 0px" }}
|
||||
transition={{ duration: 0.6, delay, ease: [0.25, 0.1, 0.25, 1] }}
|
||||
>
|
||||
{children}
|
||||
</motion.div>
|
||||
</InView>
|
||||
)
|
||||
}
|
||||
@@ -10,6 +10,7 @@ type ButtonSize = "sm" | "md" | "lg"
|
||||
interface ButtonProps extends ComponentPropsWithoutRef<"button"> {
|
||||
variant?: ButtonVariant
|
||||
size?: ButtonSize
|
||||
icon?: React.ReactNode
|
||||
href?: string
|
||||
download?: boolean
|
||||
target?: string
|
||||
@@ -36,6 +37,7 @@ export const Button = forwardRef<
|
||||
variant = "primary",
|
||||
size = "md",
|
||||
href,
|
||||
icon,
|
||||
className = "",
|
||||
children,
|
||||
...props
|
||||
@@ -63,7 +65,10 @@ export const Button = forwardRef<
|
||||
keyof ButtonProps | "to"
|
||||
>)}
|
||||
>
|
||||
{children}
|
||||
{icon ? (<>
|
||||
{children}
|
||||
<span className="btn-icon">{icon}</span>
|
||||
</>) : children}
|
||||
</MotionLink>
|
||||
)
|
||||
}
|
||||
@@ -76,7 +81,10 @@ export const Button = forwardRef<
|
||||
whileTap={{ scale: 0.95 }}
|
||||
{...(props as Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof ButtonProps>)}
|
||||
>
|
||||
{children}
|
||||
{icon ? (<>
|
||||
{children}
|
||||
<span className="btn-icon">{icon}</span>
|
||||
</>) : children}
|
||||
</motion.a>
|
||||
)
|
||||
}
|
||||
@@ -88,7 +96,10 @@ export const Button = forwardRef<
|
||||
whileTap={{ scale: 0.95 }}
|
||||
{...(props as Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, keyof ButtonProps>)}
|
||||
>
|
||||
{children}
|
||||
{icon ? (<>
|
||||
{children}
|
||||
<span className="btn-icon">{icon}</span>
|
||||
</>) : children}
|
||||
</motion.button>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
interface SectionHeadingProps {
|
||||
title: string
|
||||
subtitle?: string
|
||||
tag?: string
|
||||
id?: string
|
||||
}
|
||||
|
||||
export function SectionHeading({ title, subtitle, id }: SectionHeadingProps) {
|
||||
export function SectionHeading({ title, subtitle, tag, id }: SectionHeadingProps) {
|
||||
return (
|
||||
<div className="section-heading" id={id}>
|
||||
{tag && <span className="section-tag">{tag}</span>}
|
||||
<h2>{title}</h2>
|
||||
{subtitle && <p>{subtitle}</p>}
|
||||
</div>
|
||||
|
||||
@@ -27,7 +27,6 @@ export function SocialLinks({ links, className = "" }: SocialLinksProps) {
|
||||
whileTap={{ scale: 0.9 }}
|
||||
>
|
||||
{link.icon}
|
||||
<span>{link.label}</span>
|
||||
</motion.a>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
import { useEffect, useState } from "react"
|
||||
|
||||
interface TypewriterProps {
|
||||
texts: string[]
|
||||
typeSpeed?: number
|
||||
deleteSpeed?: number
|
||||
pauseDuration?: number
|
||||
}
|
||||
|
||||
export function Typewriter({
|
||||
texts,
|
||||
typeSpeed = 80,
|
||||
deleteSpeed = 40,
|
||||
pauseDuration = 2000,
|
||||
}: TypewriterProps) {
|
||||
const [currentTextIndex, setCurrentTextIndex] = useState(0)
|
||||
const [currentText, setCurrentText] = useState("")
|
||||
|
||||
const [isDeleting, setIsDeleting] = useState(false)
|
||||
useEffect(() => {
|
||||
const text = texts[currentTextIndex]
|
||||
let timeout: number
|
||||
|
||||
if (!isDeleting && currentText === text) {
|
||||
timeout = setTimeout(() => setIsDeleting(true), pauseDuration)
|
||||
} else if (isDeleting && currentText === "") {
|
||||
setIsDeleting(false)
|
||||
setCurrentTextIndex((prev) => (prev + 1) % texts.length)
|
||||
} else {
|
||||
timeout = setTimeout(
|
||||
() => {
|
||||
if (isDeleting) {
|
||||
setCurrentText(text.substring(0, currentText.length - 1))
|
||||
} else {
|
||||
setCurrentText(text.substring(0, currentText.length + 1))
|
||||
}
|
||||
},
|
||||
isDeleting ? deleteSpeed : typeSpeed,
|
||||
)
|
||||
}
|
||||
|
||||
return () => clearTimeout(timeout)
|
||||
}, [currentText, currentTextIndex, isDeleting, texts, typeSpeed, deleteSpeed, pauseDuration])
|
||||
|
||||
return (
|
||||
<span>
|
||||
{currentText}
|
||||
<span className="typewriter-cursor" />
|
||||
</span>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user