UNPKG

shineout

Version:

Shein 前端组件库

48 lines (41 loc) 1.47 kB
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose"; import React, { PureComponent } from 'react'; import classnames from 'classnames'; import icons from '../icons'; import { cardClass } from './styles'; import { isRTL } from '../config'; var Header = /*#__PURE__*/ function (_PureComponent) { _inheritsLoose(Header, _PureComponent); function Header() { return _PureComponent.apply(this, arguments) || this; } var _proto = Header.prototype; _proto.renderIndicator = function renderIndicator() { var collapsed = this.props.collapsed; if (collapsed === undefined) return undefined; var className = cardClass('indicator'); return React.createElement("span", { className: className }, icons.AngleRight); }; _proto.render = function render() { var _this$props = this.props, style = _this$props.style, align = _this$props.align, className = _this$props.className, children = _this$props.children, onCollapse = _this$props.onCollapse, collapsed = _this$props.collapsed; var newClassName = classnames(cardClass('header', align, isRTL() && 'header-rtl'), className); var onClick = typeof collapsed === 'boolean' ? onCollapse : undefined; return React.createElement("div", { style: style, onClick: onClick, className: newClassName }, this.renderIndicator(), children); }; return Header; }(PureComponent); export default Header;