chuni: fix music list column size when too small

This commit is contained in:
sk1982 2024-03-15 19:01:11 -04:00
parent b1c696e788
commit 4a813f80ca

View File

@ -84,7 +84,7 @@ const MusicGrid = ({ music, size }: ChuniMusicListProps & { size: 'sm' | 'lg' })
{({ height, isScrolling, onChildScroll, scrollTop }) =>
(<AutoSizer disableHeight>
{({ width }) => {
const itemsPerRow = Math.floor(width / itemWidth);
const itemsPerRow = Math.max(1, Math.floor(width / itemWidth));
const rowCount = Math.ceil(music.length / itemsPerRow);
return (<List rowCount={rowCount} autoHeight height={height} width={width} rowHeight={itemHeight} isScrolling={isScrolling}