@conductionnl/nl-design-system
Version:
NL design system components created by Conduction
28 lines (27 loc) • 1.68 kB
JavaScript
;
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.List = void 0;
var jsx_runtime_1 = require("react/jsx-runtime");
/**
* This components renders bootstrap list.
*
* @returns JSX of the generated List.
*/
function List(props) {
var liItems = props.items.map(function (item) {
return props.link ? ((0, jsx_runtime_1.jsxs)("a", __assign({ href: item.href !== null ? item.href : "#", className: "list-group-item list-group-item-action" }, { children: [item.name, props.icon !== null && (0, jsx_runtime_1.jsx)("span", __assign({ className: "list-icon" }, { children: props.icon() }), void 0)] }), item.name)) : ((0, jsx_runtime_1.jsxs)("li", __assign({ className: props.group ? "list-group-item" : "list-item" }, { children: [item.value === null ? item.name : "".concat(item.name, ": ").concat(item.value), props.icon !== null && (0, jsx_runtime_1.jsx)("span", __assign({ className: "list-icon" }, { children: props.icon() }), void 0)] }), item.name));
});
return ((0, jsx_runtime_1.jsx)("section", __assign({ className: "utrecht-html" }, { children: (0, jsx_runtime_1.jsx)("ul", __assign({ className: props.group && props.groupFlush ? "list-group list-group-flush" : "list" }, { children: liItems }), void 0) }), void 0));
}
exports.List = List;