diff --git a/src/renderer/_shared/TracksGrid/TrackGridRow.tsx b/src/renderer/_shared/TracksGrid/TrackGridRow.tsx index 824b7c8c..4bb2c450 100644 --- a/src/renderer/_shared/TracksGrid/TrackGridRow.tsx +++ b/src/renderer/_shared/TracksGrid/TrackGridRow.tsx @@ -18,23 +18,17 @@ interface Props { @autobind export class TrackGridRow extends React.PureComponent { - private getClassesForItemCount(itemsPerRow: number): string { - switch (itemsPerRow) { - case 1: - return 'col-12'; - case 2: - return 'col-6'; - case 3: - return 'col-4'; - case 4: - default: - return 'col-3'; - } + get itemWidth(): string { + const { + data: { itemsPerRow } + } = this.props; + + return `${100 / itemsPerRow}%`; } private renderItem(index: number) { const { - data: { showInfo, objectId, items, itemsPerRow } + data: { showInfo, objectId, items } } = this.props; const item = items[index]; @@ -43,7 +37,8 @@ export class TrackGridRow extends React.PureComponent { return (
+ className={cn('userWrapper')} + style={{ width: this.itemWidth }}>
); @@ -52,7 +47,7 @@ export class TrackGridRow extends React.PureComponent { const showReposts = objectId === PlaylistTypes.STREAM; return ( -
+