wix-style-react
Version:
wix-style-react
27 lines (22 loc) • 1.02 kB
JavaScript
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; }
import React from 'react';
import { RTLWrapper } from './utils';
/**
* 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 React.createElement(
RTLWrapper,
{ rtl: autoExample__rtl },
React.createElement(componentType, rest)
);
}
AutoExampleWrapper.displayName = componentType.displayName;
return AutoExampleWrapper;
};
export { createAutoExampleWrapper };