mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-22 16:10:40 +07:00
feat: personal engineering portfolio with routing, theme toggle, and responsive design
- React + TypeScript + Vite + React Router v6 - Dark/light/system theme toggle (fixed cycle from 'system' state) - Multi-page SPA: Home, About, Experience, Projects, Engineering, Contact - Responsive layout with mobile menu - Data-driven sections (profile, skills, experience, projects) - CSS Modules-compatible with CSS variables for theming - Accessibility: skip-link, ARIA labels, keyboard navigation
This commit is contained in:
1 parent
0273f555de
commit
7e42bd8017
38 files changed
+2921
-358
No files matched your search
@@ -0,0 +1,19 @@
|
||||
interface BadgeProps {
|
||||
children: React.ReactNode
|
||||
variant?: 'accent' | 'outline' | 'muted'
|
||||
className?: string
|
||||
}
|
||||
|
||||
const variantClasses: Record<'accent' | 'outline' | 'muted', string> = {
|
||||
accent: 'badge badge-accent',
|
||||
outline: 'badge badge-outline',
|
||||
muted: 'badge badge-muted',
|
||||
}
|
||||
|
||||
export function Badge({ children, variant = 'muted', className = '' }: BadgeProps) {
|
||||
return (
|
||||
<span className={`${variantClasses[variant]} ${className}`}>
|
||||
{children}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import { forwardRef } from 'react'
|
||||
import type { ComponentPropsWithoutRef } from 'react'
|
||||
|
||||
type ButtonVariant = 'primary' | 'secondary' | 'ghost'
|
||||
type ButtonSize = 'sm' | 'md' | 'lg'
|
||||
|
||||
interface ButtonProps extends ComponentPropsWithoutRef<'button'> {
|
||||
variant?: ButtonVariant
|
||||
size?: ButtonSize
|
||||
href?: string
|
||||
children: React.ReactNode
|
||||
}
|
||||
|
||||
const variantClasses: Record<ButtonVariant, string> = {
|
||||
primary: 'btn btn-primary',
|
||||
secondary: 'btn btn-secondary',
|
||||
ghost: 'btn btn-ghost',
|
||||
}
|
||||
|
||||
const sizeClasses: Record<ButtonSize, string> = {
|
||||
sm: 'btn-sm',
|
||||
md: '',
|
||||
lg: 'btn-lg',
|
||||
}
|
||||
|
||||
export const Button = forwardRef<
|
||||
HTMLButtonElement | HTMLAnchorElement,
|
||||
ButtonProps
|
||||
>(({ variant = 'primary', size = 'md', href, className = '', children, ...props }, ref) => {
|
||||
const classes = `${variantClasses[variant]} ${sizeClasses[size]} ${className}`.trim()
|
||||
|
||||
if (href) {
|
||||
return (
|
||||
<a href={href} className={classes} ref={ref as React.Ref<HTMLAnchorElement>} {...(props as React.AnchorHTMLAttributes<HTMLAnchorElement>)}>
|
||||
{children}
|
||||
</a>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<button className={classes} ref={ref as React.Ref<HTMLButtonElement>} {...props}>
|
||||
{children}
|
||||
</button>
|
||||
)
|
||||
})
|
||||
|
||||
Button.displayName = 'Button'
|
||||
@@ -0,0 +1,31 @@
|
||||
import { forwardRef } from 'react'
|
||||
import type { ComponentPropsWithoutRef } from 'react'
|
||||
|
||||
type CardVariant = 'default' | 'elevated' | 'featured'
|
||||
|
||||
interface CardProps extends ComponentPropsWithoutRef<'div'> {
|
||||
variant?: CardVariant
|
||||
children: React.ReactNode
|
||||
}
|
||||
|
||||
const variantClasses: Record<CardVariant, string> = {
|
||||
default: 'card',
|
||||
elevated: 'card card-elevated',
|
||||
featured: 'card card-featured',
|
||||
}
|
||||
|
||||
export const Card = forwardRef<HTMLDivElement, CardProps>(
|
||||
({ variant = 'default', className = '', children, ...props }, ref) => {
|
||||
return (
|
||||
<div
|
||||
className={`${variantClasses[variant]} ${className}`.trim()}
|
||||
ref={ref}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
Card.displayName = 'Card'
|
||||
@@ -0,0 +1,14 @@
|
||||
interface SectionHeadingProps {
|
||||
title: string
|
||||
subtitle?: string
|
||||
id?: string
|
||||
}
|
||||
|
||||
export function SectionHeading({ title, subtitle, id }: SectionHeadingProps) {
|
||||
return (
|
||||
<div className="section-heading" id={id}>
|
||||
<h2>{title}</h2>
|
||||
{subtitle && <p>{subtitle}</p>}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
interface SocialLink {
|
||||
label: string
|
||||
href: string
|
||||
icon: React.ReactNode
|
||||
'aria-label': string
|
||||
}
|
||||
|
||||
interface SocialLinksProps {
|
||||
links: SocialLink[]
|
||||
className?: string
|
||||
}
|
||||
|
||||
export function SocialLinks({ links, className = '' }: SocialLinksProps) {
|
||||
return (
|
||||
<div className={`social-links ${className}`}>
|
||||
{links.map((link) => (
|
||||
<a
|
||||
key={link.label}
|
||||
href={link.href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="social-link"
|
||||
aria-label={link['aria-label']}
|
||||
>
|
||||
{link.icon}
|
||||
<span>{link.label}</span>
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
interface TagProps {
|
||||
children: React.ReactNode
|
||||
accent?: boolean
|
||||
className?: string
|
||||
}
|
||||
|
||||
export function Tag({ children, accent = false, className = '' }: TagProps) {
|
||||
return (
|
||||
<span className={`tag ${accent ? 'tag-accent' : ''} ${className}`}>
|
||||
{children}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user