From 64adb92a107c5f0c0520797d4938ce1fdf017274 Mon Sep 17 00:00:00 2001 From: Chris Beer <cabeer@stanford.edu> Date: Tue, 15 Jun 2021 17:33:29 -0700 Subject: [PATCH] Use an explicit placeholder for missing manifest thumbnails (#3447) --- src/components/ManifestListItem.js | 63 +++++++++++++++++------------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/src/components/ManifestListItem.js b/src/components/ManifestListItem.js index 1b4ae7d35..06f764325 100644 --- a/src/components/ManifestListItem.js +++ b/src/components/ManifestListItem.js @@ -104,21 +104,25 @@ export class ManifestListItem extends React.Component { > <Grid container spacing={2} className={classes.label} component="span"> <Grid item xs={4} sm={3} component="span"> - <Img - className={[classes.thumbnail, ns('manifest-list-item-thumb')].join(' ')} - src={[thumbnail]} - alt="" - height="80" - unloader={( - <Skeleton - variant="rect" - animation={false} - className={classes.placeholder} - height={80} - width={120} + { thumbnail + ? ( + <Img + className={[classes.thumbnail, ns('manifest-list-item-thumb')].join(' ')} + src={[thumbnail]} + alt="" + height="80" + unloader={( + <Skeleton + variant="rect" + animation={false} + className={classes.placeholder} + height={80} + width={120} + /> + )} /> - )} - /> + ) + : <Skeleton className={classes.placeholder} variant="rect" height={80} width={120} />} </Grid> <Grid item xs={8} sm={9} component="span"> { isCollection && ( @@ -139,21 +143,24 @@ export class ManifestListItem extends React.Component { </Grid> <Grid item xs={4} sm={2}> - <Img - src={[manifestLogo]} - alt="" - role="presentation" - className={classes.logo} - unloader={( - <Skeleton - variant="rect" - animation={false} - className={classes.placeholder} - height={60} - width={60} - /> + { manifestLogo + && ( + <Img + src={[manifestLogo]} + alt="" + role="presentation" + className={classes.logo} + unloader={( + <Skeleton + variant="rect" + animation={false} + className={classes.placeholder} + height={60} + width={60} + /> + )} + /> )} - /> </Grid> </Grid> ) : ( -- GitLab