wix-style-react
Version:
wix-style-react
39 lines (29 loc) • 1.34 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAutoExampleWrapper = undefined;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _utils = require('./utils');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
/**
* Creates a component wrapper that Wrapper which:
* - Adds autoExample__rtl prop mode if the URL query param `rtl` is defined
*/
var createAutoExampleWrapper = function createAutoExampleWrapper(componentType) {
function AutoExampleWrapper(props) {
// Prefixing with `autoExample__` to avoid name clashes with component props
var autoExample__rtl = props.autoExample__rtl,
rest = _objectWithoutProperties(props, ['autoExample__rtl']);
return _react2.default.createElement(
_utils.RTLWrapper,
{ rtl: autoExample__rtl },
_react2.default.createElement(componentType, rest)
);
}
AutoExampleWrapper.displayName = componentType.displayName;
return AutoExampleWrapper;
};
exports.createAutoExampleWrapper = createAutoExampleWrapper;