Skip to content

Commit

Permalink
Merge pull request #1353 from danskernesdigitalebibliotek/DDFFORM-835…
Browse files Browse the repository at this point in the history
…-hvis-en-material-grid-automatic-har-0-hits-sa-skal-den-skjules

Handle zero hits in `MaterialGrid`
  • Loading branch information
kasperbirch1 authored Aug 5, 2024
2 parents 8905257 + 909a32d commit 6973e40
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/apps/material-grid/MaterialGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ const MaterialGrid: React.FC<MaterialGridProps> = ({
setShowAllMaterials(!showAllMaterials);
}

if (!materials.length) {
// eslint-disable-next-line no-console
console.warn(`No materials to show for MaterialGrid: ${title}`);
return null;
}

const titleClasses = clsx("material-grid__title", {
"material-grid__title--no-description": !description
});
Expand Down

0 comments on commit 6973e40

Please sign in to comment.