We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 45081d2 commit 88bfbebCopy full SHA for 88bfbeb
apps/frontend/src/modules/browse/components/SongCardGroup.tsx
@@ -1,7 +1,17 @@
1
const SongCardGroup = ({ children }: { children: React.ReactNode }) => {
2
+ // Ensure at least 4 items in the grid to prevent single cards from taking up full width
3
+ const childrenArray = Array.isArray(children) ? children : [children];
4
+ const itemsToDisplay = Math.max(childrenArray.length, 4);
5
+ const paddedSongs = [
6
+ ...childrenArray,
7
+ ...Array.from({ length: itemsToDisplay - childrenArray.length }, (_, i) => (
8
+ <div key={`placeholder-${i}`} aria-hidden='true' />
9
+ )),
10
+ ];
11
+
12
return (
13
<div className='grid grid-auto-fit-md w-full items-center gap-4'>
- {children}
14
+ {paddedSongs}
15
</div>
16
);
17
};
0 commit comments