@open-tender/ui
Version:
A component library for use with the Open Tender web app
26 lines (25 loc) • 2.46 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const components_1 = require("../components");
const utils_1 = require("../utils");
const Category = ({ config, category, renderHeader, renderCategoryNav, renderCategoryItem }) => {
const { name, description, items, children } = category;
return (react_1.default.createElement(react_1.default.Fragment, null,
renderHeader(),
renderCategoryNav(),
react_1.default.createElement(components_1.View, Object.assign({}, (0, utils_1.makeProps)(config, 'category')),
react_1.default.createElement(components_1.View, Object.assign({}, (0, utils_1.makeProps)(config, 'category__header')),
react_1.default.createElement(components_1.View, Object.assign({}, (0, utils_1.makeProps)(config, 'category__headerContainer')),
react_1.default.createElement(components_1.Text, Object.assign({}, (0, utils_1.makeProps)(config, 'category__title'), { text: name })),
description && (react_1.default.createElement(components_1.Text, Object.assign({}, (0, utils_1.makeProps)(config, 'category__subtitle'), { text: description }))))),
react_1.default.createElement(components_1.View, Object.assign({}, (0, utils_1.makeProps)(config, 'category__content')),
react_1.default.createElement(components_1.View, Object.assign({}, (0, utils_1.makeProps)(config, 'category__items')), items.map(item => renderCategoryItem(item))),
children.map(child => (react_1.default.createElement(react_1.default.Fragment, null,
react_1.default.createElement(components_1.View, Object.assign({ key: child.id }, (0, utils_1.makeProps)(config, 'category__childHeader')),
react_1.default.createElement(components_1.Text, Object.assign({}, (0, utils_1.makeProps)(config, 'category__childTitle'), { text: child.name })),
child.description && (react_1.default.createElement(components_1.Text, Object.assign({}, (0, utils_1.makeProps)(config, 'category__childSubtitle'), { text: child.description })))),
react_1.default.createElement(components_1.View, Object.assign({}, (0, utils_1.makeProps)(config, 'category__items')), child.items.map(item => renderCategoryItem(item))))))))));
};
exports.default = Category;