一键导入
react-patterns
Advanced React patterns and best practices used in this portfolio
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Advanced React patterns and best practices used in this portfolio
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Migrate from Next.js 15 to Next.js 16 and handle breaking changes
Configure Content Security Policy and security headers for the portfolio
Deploy Next.js to Cloudflare Workers using OpenNext adapter
Manage the canary token honeypot system for detecting security scanning
Write, debug, and optimize GROQ queries for Sanity CMS in this portfolio
Advanced TypeScript patterns and type safety as used in this portfolio
| name | react-patterns |
| description | Advanced React patterns and best practices used in this portfolio |
Advanced React patterns, hooks, and best practices as applied in the PP Namias portfolio.
The portfolio uses a modal system built with compound components:
// src/components/ui/Modal.tsx
<Modal isOpen={isOpen} onClose={onClose}>
<ModalHeader>Title</ModalHeader>
<ModalBody>Content</ModalBody>
<ModalFooter>Actions</ModalFooter>
</Modal>
Registration: All modals are registered in src/hooks/useModal.tsx with typed keys.
// Always isolate SWR in tests
<SWRConfig value={{ provider: () => new Map() }}>
<Component />
</SWRConfig>
All sections follow the same pattern:
// src/components/sections/SectionName.tsx
'use client';
import { motion } from 'framer-motion';
export default function SectionName({ data }: Props) {
return (
<section>
<motion.div whileInView={{ opacity: 1 }} />
</section>
);
}
// Always use OptimizedImage, not raw <img>
<OptimizedImage
src={url}
alt={alt}
width={800}
height={600}
priority={isAboveFold}
/>
const TabsContext = createContext(null);
function Tabs({ children, defaultValue }) {
const [active, setActive] = useState(defaultValue);
return (
<TabsContext.Provider value={{ active, setActive }}>
<div>{children}</div>
</TabsContext.Provider>
);
}
function useMediaQuery(query: string) {
const [matches, setMatches] = useState(false);
useEffect(() => {
const mql = window.matchMedia(query);
setMatches(mql.matches);
const handler = (e: MediaQueryListEvent) => setMatches(e.matches);
mql.addEventListener('change', handler);
return () => mql.removeEventListener('change', handler);
}, [query]);
return matches;
}
// Split value and dispatch to prevent unnecessary re-renders
const StateContext = createContext(null);
const DispatchContext = createContext(null);
provider: () => new Map())useModal.tsxOptimizedImage component