antd
Version:
An enterprise-class UI design language and React-based implementation
38 lines (36 loc) • 1.81 kB
JavaScript
import _extends from 'babel-runtime/helpers/extends';
import _defineProperty from 'babel-runtime/helpers/defineProperty';
var __rest = this && this.__rest || function (s, e) {
var t = {};
for (var p in s) {
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
}if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]];
}return t;
};
import * as React from 'react';
import classNames from 'classnames';
export default function Divider(_a) {
var _classNames;
var _a$prefixCls = _a.prefixCls,
prefixCls = _a$prefixCls === undefined ? 'ant' : _a$prefixCls,
_a$type = _a.type,
type = _a$type === undefined ? 'horizontal' : _a$type,
_a$orientation = _a.orientation,
orientation = _a$orientation === undefined ? '' : _a$orientation,
className = _a.className,
children = _a.children,
dashed = _a.dashed,
restProps = __rest(_a, ["prefixCls", "type", "orientation", "className", "children", "dashed"]);
var orientationPrefix = orientation.length > 0 ? '-' + orientation : orientation;
var classString = classNames(className, prefixCls + '-divider', prefixCls + '-divider-' + type, (_classNames = {}, _defineProperty(_classNames, prefixCls + '-divider-with-text' + orientationPrefix, children), _defineProperty(_classNames, prefixCls + '-divider-dashed', !!dashed), _classNames));
return React.createElement(
'div',
_extends({ className: classString }, restProps),
children && React.createElement(
'span',
{ className: prefixCls + '-divider-inner-text' },
children
)
);
}