Skip to content

Commit b862a21

Browse files
committed
show 7 items at once if more
Signed-off-by: nidhi-singh02 <nidhi2894@gmail.com>
1 parent 0a723fc commit b862a21

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

components/SponsoredFeedsTable.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,13 @@ export const SponsoredFeedsTable = ({
3838
// Calculate table height based on number of items
3939
// Each row is approximately 40px (py-2 = 8px top + 8px bottom + content height)
4040
// Header is approximately 48px (py-2 = 8px top + 8px bottom + font height)
41-
// Show 7 rows by default, then scroll
41+
// Show 7 rows by default, then scroll - but maintain consistent minimum height
4242
const maxVisibleRows = 7;
4343
const shouldScroll = feeds.length > maxVisibleRows;
44-
const tableHeight = shouldScroll ? `${48 + maxVisibleRows * 40}px` : "auto";
44+
const rowHeight = 56; // Increased row height to account for actual content height
45+
const headerHeight = 48; // Header height in pixels
46+
const exactTableHeight = `${headerHeight + maxVisibleRows * rowHeight}px`; // Exact height for 7 rows
47+
const tableHeight = shouldScroll ? exactTableHeight : "auto"; // Use exact height for scrollable tables
4548

4649
return (
4750
<div className="my-6">

0 commit comments

Comments
 (0)