* Calculate evenly distributed column widths that sum exactly to availableWidth. * Distributes remainder pixels across the first N columns so there's no gap.
(count: number, availableWidth: number)
| 57 | * Distributes remainder pixels across the first N columns so there's no gap. |
| 58 | */ |
| 59 | function columnWidths(count: number, availableWidth: number): number[] { |
| 60 | const base = Math.floor(availableWidth / count) |
| 61 | const remainder = availableWidth - base * count |
| 62 | return Array.from({ length: count }, (_, i) => base + (i < remainder ? 1 : 0)) |
| 63 | } |
| 64 | |
| 65 | export const ChoiceAdBanner: React.FC<ChoiceAdBannerProps> = ({ |
| 66 | ads, |