Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
renderData(articles) {
const { hasFeaturedItem } = this.props;
// Group the articles into rows with 2 columns
// If the screen has a featured article, it is the first article
let isFeaturedArticle = hasFeaturedItem;
const groupedArticles = GridRow.groupByRows(articles, GRID_ITEMS_PER_ROW, () => {
if (isFeaturedArticle) {
// The first article is featured, and it
// should take up the entire width of the grid
isFeaturedArticle = false;
return GRID_ITEMS_PER_ROW;
}
return 1;
});
// Transfer the loading status from the original collection
cloneStatus(articles, groupedArticles);
return super.renderData(groupedArticles);
}
}
renderData(articles) {
const { hasFeaturedItem } = this.props;
// Group the articles into rows with 2 columns, except for the
// first article. The first article is treated as a featured article
let isFirstArticle = hasFeaturedItem;
const groupedArticles = GridRow.groupByRows(articles, 2, () => {
if (isFirstArticle) {
isFirstArticle = false;
return 2;
}
return 1;
});
// Transfer the loading status from the original collection
cloneStatus(articles, groupedArticles);
return super.renderData(groupedArticles);
}
}
renderData(articles) {
// Group the articles into rows with 2 columns, except for the
// first article. The first article is treated as a featured article
let isFirstArticle = true;
const groupedArticles = GridRow.groupByRows(articles, 2, () => {
if (isFirstArticle) {
isFirstArticle = false;
return 2;
}
return 1;
});
// Transfer the loading status from the original collection
cloneStatus(articles, groupedArticles);
return super.renderData(groupedArticles);
}
}
renderData(articles) {
const { hasFeaturedItem } = this.props;
// Group the articles into rows with 2 columns, except for the
// first article. The first article is treated as a featured article
let isFirstArticle = hasFeaturedItem;
const groupedArticles = GridRow.groupByRows(articles, 2, () => {
if (isFirstArticle) {
isFirstArticle = false;
return 2;
}
return 1;
});
// Transfer the loading status from the original collection
cloneStatus(articles, groupedArticles);
return super.renderData(groupedArticles);
}
}
renderData(deals) {
const { isLoading } = this.state;
const groupedDeals = GridRow.groupByRows(deals, 2);
cloneStatus(deals, groupedDeals);
const loading = isBusy(groupedDeals) || !isInitialized(groupedDeals) || isLoading;
return (
);
}
renderData(events) {
const { hasFeaturedItem } = this.props;
const { shouldRenderMap } = this.state;
if (shouldRenderMap) {
return this.renderEventsMap(events);
}
let isItemFeatured = hasFeaturedItem;
const groupedEvents = GridRow.groupByRows(events, 2, () => {
if (isItemFeatured) {
isItemFeatured = false;
return 2;
}
return 1;
});
cloneStatus(events, groupedEvents);
return super.renderData(groupedEvents);
}
}
renderData(events) {
const { shouldRenderMap } = this.state;
if (shouldRenderMap) {
return this.renderEventsMap(events);
}
const groupedEvents = GridRow.groupByRows(events, 2, event => (event.featured ? 2 : 1));
cloneStatus(events, groupedEvents);
return super.renderData(groupedEvents);
}
}
groupItemsIntoRows(items) {
const { cols } = this.getLayoutSettings();
return GridRow.groupByRows(items, cols);
}
renderData() {
const { photos } = this.state;
const groupedPhotos = GridRow.groupByRows(photos, NUMBER_OF_COLUMNS);
cloneStatus(photos, groupedPhotos);
return super.renderData(groupedPhotos);
}
}
renderRows(page = []) {
const groupedShortcuts = GridRow.groupByRows(page, TileGrid.ROW_COUNT);
return groupedShortcuts.map(this.renderRow);
}
}