11import React , { useState } from "react" ;
22
3+ // Size of the ZX rainbow ribbon baked into the bottom-right corner of a
4+ // screenshot thumbnail (square, so the diagonal stays at 45deg). Tweak here.
5+ const RIBBON_SIZE = "44px" ;
6+
37// Tilted corner thumbnail for a project card. The box is 4:3 to match the
48// Spectrum screenshot's aspect, so the rendered PNG from gif-service fills it
5- // exactly with no crop (only the tilt trims the corners). Falls back to the
6- // static cartridge graphic when there's no screenshot yet, the project isn't
7- // public, or it can't be rendered (e.g. zmac/sdcc).
9+ // exactly with no crop (only the tilt trims the corners). Screenshots get a
10+ // small diagonal rainbow ribbon in the corner (the same one the cartridge
11+ // shows full-size). Falls back to the static cartridge graphic when there's no
12+ // screenshot yet, the project isn't public, or it can't be rendered (e.g.
13+ // zmac/sdcc) — that already carries the ribbon, so no overlay is added.
814export default function ProjectThumbnail ( { projectId, updatedAt } ) {
915 const [ failed , setFailed ] = useState ( false ) ;
1016 const version = updatedAt ? Date . parse ( updatedAt ) || 0 : 0 ;
@@ -28,11 +34,26 @@ export default function ProjectThumbnail({ projectId, updatedAt }) {
2834 } }
2935 >
3036 < img
31- src = { showShot ? `/screenshots/${ projectId } .png?v=${ version } ` : "/assets/images/zx-square .png" }
37+ src = { showShot ? `/screenshots/${ projectId } .png?v=${ version } ` : "/assets/images/zx-card .png" }
3238 alt = ""
3339 onError = { showShot ? ( ) => setFailed ( true ) : undefined }
3440 style = { { width : "100%" , height : "100%" , objectFit : "cover" } }
3541 />
42+ { showShot && (
43+ < img
44+ src = "/assets/images/zx-ribbon.png"
45+ alt = ""
46+ aria-hidden = "true"
47+ style = { {
48+ position : "absolute" ,
49+ right : 0 ,
50+ bottom : 0 ,
51+ width : RIBBON_SIZE ,
52+ height : RIBBON_SIZE ,
53+ pointerEvents : "none" ,
54+ } }
55+ />
56+ ) }
3657 </ div >
3758 ) ;
3859}
0 commit comments