import React from "react";
import AppCard from "./AppCard";
const CARDS_PER_ROW = 2;
const AppList = (props) => {
    const getCardsInRow = () => {
        const rows = [];
        let cardsInRow = [];
        for (let i = 0; i < props.cards.length; i++) {
            const card = props.cards[i];
            const name = card.title || card.name;
            const cardKey = `card ${name} ${i}`;
            cardsInRow.push(React.createElement("td", { key: cardKey },
                React.createElement(AppCard, { ...card, viewAppShowcase: props.viewAppShowcase })));
            if (cardsInRow.length === CARDS_PER_ROW || i === props.cards.length - 1) {
                rows.push(cardsInRow);
                cardsInRow = [];
            }
        }
        return rows;
    };
    return (React.createElement("div", { className: "app-card-list" },
        React.createElement("table", null,
            React.createElement("tbody", null, getCardsInRow().map((row, i) => (React.createElement("tr", { key: `cardrow-${i}` }, row)))))));
};
export default AppList;
//# sourceMappingURL=AppList.js.map