@limetech/lime-elements
Version:
49 lines (48 loc) • 1.68 kB
JavaScript
import React from 'react';
export class Row extends React.Component {
constructor(props) {
super(props);
this.props = props;
}
render() {
const classes = ['row'];
if (this.icon) {
classes.push('has-icon');
}
return React.createElement('div', {
className: classes.join(' '),
}, this.renderMainInformation(), this.renderDescription());
}
renderIcon() {
if (this.icon) {
return React.createElement('limel-icon', {
name: this.icon,
});
}
}
renderMainInformation() {
return React.createElement('div', { className: 'main-information' }, this.renderIcon(), this.renderTitle(), this.renderChildren());
}
renderTitle() {
var _a;
return React.createElement('h1', { className: 'title' }, (_a = this.schema) === null || _a === void 0 ? void 0 : _a.title);
}
renderDescription() {
var _a;
if ((_a = this.schema) === null || _a === void 0 ? void 0 : _a.description) {
return React.createElement('p', { className: 'description' }, this.schema.description);
}
}
renderChildren() {
const children = this.props.children;
return Object.assign(Object.assign({}, children), { props: Object.assign(Object.assign({}, children.props), { schema: Object.assign(Object.assign({}, children.props.schema), { title: null, description: null }) }) });
}
get schema() {
return this.props.children.props.schema;
}
get icon() {
var _a, _b, _c;
return (_c = (_b = (_a = this.schema) === null || _a === void 0 ? void 0 : _a.lime) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.icon;
}
}
//# sourceMappingURL=row.js.map