website: add pixelated image placeholders with fade-in transition
Build-time script generates tiny 32px-wide versions of all images in public/ using sharp. At runtime, PixelatedImage component renders these with CSS image-rendering: pixelated (nearest-neighbor / point sampling) for a crisp mosaic effect, then fades in the real image on load. - Auto-discovers images in public/, skips placeholder- prefixed files - Mtime check skips regeneration when placeholder is newer than source - Callback ref handles cached images where onLoad fires before mount - Explicit z-index prevents placeholder from covering the real image - Runs automatically as part of pnpm build in website package
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "react-router build",
|
||||
"placeholders": "tsx scripts/generate-placeholders.ts",
|
||||
"build": "tsx scripts/generate-placeholders.ts && react-router build",
|
||||
"dev": "react-router dev --port 8044",
|
||||
"typecheck": "react-router typegen && tsc"
|
||||
},
|
||||
@@ -39,6 +40,7 @@
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@vitejs/plugin-react": "^5.1.2",
|
||||
"@xmorse/deployment-utils": "^0.7.2",
|
||||
"sharp": "^0.34.5",
|
||||
"tailwindcss": "^4.2.0",
|
||||
"typescript": "^5.9.3",
|
||||
"vite": "^7.3.0",
|
||||
|
||||
Reference in New Issue
Block a user