You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// the following takes place on initial load and subsequent rendersvarriverSoloItems=bundle.containers.river[0].items;varriverSoloComponents=_.map(riverSoloItems,function(item){return<RiverSolo{...item}/>;});vartrioItems=bundle.containers.trio[0].items;vartrioComponents=_.map(trioItems,function(item){return<RiverFeatured{...item}/>;});// or something?// remember - first 4 items in the river are consumed by an entirely different componentvarsection1=<section>[
riverSoloComponents.slice(4, 6),
trioComponents[0],
riverSoloComponents.slice(6, 8)]
</section>;varsection2=<section>[
riverSoloComponents.slice(8, 10),
trioComponents[1],
riverSoloComponents.slice(10, 12)]
</section>;varsection3=<section>[
riverSoloComponents.slice(12, 14),
trioComponents[2],
riverSoloComponents.slice(14, 16)]
</section>;// Okay now it gets really kooky// How many remaining items are there? Total items minus page size (for first page)// Iterate and add new sections to nextSections// Probably cleaner ways to do this - this just captures the conceptvarremainingItemsCount=riverSoloItems.length-16;varnextSections=[];for(vari=15;i<remainingItemsCount,i+=4){varitems=riverSoloComponents.slice(i,i+4);nextSections.push(<section>[items]</section>);}varriverItems=[section1,section2,section3].concat(nextSections);varriver=<APRiveritems={riverItems}/>;
Concerns
max items logic - breaks because itemsPerPage does not match number of "parent" elements we're passing to the river