wix-style-react
Version:
68 lines (53 loc) • 2.78 kB
JavaScript
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _inherits from "@babel/runtime/helpers/inherits";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
import React from 'react';
import PropTypes from 'prop-types';
import { st, classes } from './Divider.st.css';
import { directions, skins } from './constants';
/** A component that separates content by a line horizontally or vertically */
var Divider = /*#__PURE__*/function (_React$PureComponent) {
_inherits(Divider, _React$PureComponent);
var _super = _createSuper(Divider);
function Divider() {
_classCallCheck(this, Divider);
return _super.apply(this, arguments);
}
_createClass(Divider, [{
key: "render",
value: function render() {
var _this$props = this.props,
dataHook = _this$props.dataHook,
className = _this$props.className,
direction = _this$props.direction,
skin = _this$props.skin;
return /*#__PURE__*/React.createElement("hr", {
"data-hook": dataHook,
className: st(classes.root, {
direction: direction,
skin: skin
}, className)
});
}
}]);
return Divider;
}(React.PureComponent);
_defineProperty(Divider, "displayName", 'Divider');
_defineProperty(Divider, "propTypes", {
/** Applies a data-hook HTML attribute that can be used in the tests. */
dataHook: PropTypes.string,
/** Controls divider direction. */
direction: PropTypes.oneOf(['horizontal', 'vertical']),
/** Sets the skin of the divider. */
skin: PropTypes.oneOf(['light', 'dark', 'standard', 'warning', 'destructive', 'success', 'premium'])
});
_defineProperty(Divider, "defaultProps", {
direction: directions.horizontal,
skin: skins.light
});
export default Divider;