@zohodesk/dot
Version:
In this Library, we Provide Some Basic Components to Build Your Application
66 lines (56 loc) • 2.52 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = Separator;
var _react = _interopRequireDefault(require("react"));
var _Layout = require("@zohodesk/components/es/v1/Layout");
var _defaultProps = require("./props/defaultProps");
var _propTypes = require("./props/propTypes");
var _SeparatorModule = _interopRequireDefault(require("../../Separator/Separator.module.css"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function Separator(props) {
var children = props.children,
type = props.type,
customSeparatorType = props.customSeparatorType,
palette = props.palette,
wrap = props.wrap,
shrink = props.shrink,
aligndirection = props.aligndirection,
customClass = props.customClass;
var customWrapper = customClass.customWrapper,
customSeparator = customClass.customSeparator,
customChildren = customClass.customChildren;
var data = children.filter(function (el) {
return el !== null && el !== undefined && el !== false;
});
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
alignBox: aligndirection,
align: aligndirection === 'row' ? 'vertical' : '',
wrap: wrap,
isCover: false,
className: "".concat(_SeparatorModule["default"].varClass, " ").concat(customWrapper)
}, data.map(function (child, i) {
if (child) {
if (data.length - 1 == i || aligndirection == 'column') {
return child && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
shrink: shrink,
key: i,
className: customChildren
}, child);
}
return child && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, {
key: i
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
shrink: shrink,
key: i,
className: customChildren
}, child), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
className: "".concat(_SeparatorModule["default"].separator, " ").concat(_SeparatorModule["default"][palette], " ").concat(customSeparatorType ? '' : _SeparatorModule["default"][type], " ").concat(customSeparator, " "),
key: i
}, customSeparatorType ? customSeparatorType : type == 'slash' ? '/' : type == 'arrow' ? '>' : type == 'comma' ? ',' : "\u2022"));
}
}));
}
Separator.defaultProps = _defaultProps.defaultProps;
Separator.propTypes = _propTypes.propTypes;