UNPKG

@aliretail/react-materials-components

Version:
56 lines (51 loc) 1.98 kB
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose"; import React, { Component } from 'react'; import cls from 'classnames'; import { StatusTag } from "../../../StatusTag"; // import { layout } from '../../factory'; import { COMPONENT_NAME } from "../../factory/static"; export var Section = /*#__PURE__*/function (_Component) { _inheritsLoose(Section, _Component); function Section() { return _Component.apply(this, arguments) || this; } var _proto = Section.prototype; _proto.render = function render() { var _this$props = this.props, className = _this$props.className, containerClassName = _this$props.containerClassName, title = _this$props.title, _this$props$tags = _this$props.tags, tags = _this$props$tags === void 0 ? [] : _this$props$tags, subTitle = _this$props.subTitle, children = _this$props.children; var showTitle = !!title; var showSubTitle = !!subTitle; return /*#__PURE__*/React.createElement("div", { className: cls('aliretail-layout-section', className, { 'no-title': !showTitle }), "data-name": COMPONENT_NAME + "Section" }, showTitle && /*#__PURE__*/React.createElement("div", { className: "aliretail-layout-section-title" }, /*#__PURE__*/React.createElement("span", null, title), tags.map(function (tag, i) { var text = tag.text, type = tag.type, color = tag.color; return ( /*#__PURE__*/ // @ts-ignore React.createElement(StatusTag, { key: i, text: text, type: type, color: color }) ); }), showSubTitle && /*#__PURE__*/React.createElement("span", { className: "aliretail-layout-section-title-sub" }, subTitle)), /*#__PURE__*/React.createElement("div", { className: cls('aliretail-layout-section-content', containerClassName) }, children)); }; return Section; }(Component);