wix-style-react
Version:
wix-style-react
40 lines • 1.98 kB
JavaScript
import React from 'react';
import PropTypes from 'prop-types';
import { featuresMap } from './constants';
import { WixStyleReactContext } from './context';
import { classes as newColorsBrandingClasses, st, } from './newColorsBranding.st.css';
import { classes as madeforClasses } from './madefor.st.css';
/** Wix Style React Provider */
const WixStyleReactProvider = ({ dataHook, className, as = 'span', children, features = {}, typographyClass, theme = {}, ...rest }) => (React.createElement(WixStyleReactContext.Provider, { value: {
newBrandingClass: features[featuresMap.newColorsBranding] &&
newColorsBrandingClasses.root,
...features,
} }, React.createElement(as, {
...rest,
'data-hook': dataHook,
className: st(typographyClass, className, features[featuresMap.newColorsBranding] &&
newColorsBrandingClasses.root, madeforClasses.madefor, theme?.className),
}, children)));
WixStyleReactProvider.displayName = 'WixStyleReactProvider';
WixStyleReactProvider.propTypes = {
/** Applied as data-hook HTML attribute that can be used to create driver in testing */
dataHook: PropTypes.string,
/** A css class to be applied to the component's root element */
className: PropTypes.string,
/** render as some other component or DOM tag */
as: PropTypes.oneOf(['span', 'div']),
/** A renderable node */
children: PropTypes.node,
/** A theme object applied on components */
theme: PropTypes.object,
/** Object which represent all features you would like to use. The available features are:
* - `newColorsBranding`: new business dashboard colors
* - `sidebarExperimentCollapsible`: sidebar component experiment to enable collapsible feature.
* */
features: PropTypes.shape({
newColorsBranding: PropTypes.bool,
sidebarExperimentCollapsible: PropTypes.bool,
}),
};
export default WixStyleReactProvider;
//# sourceMappingURL=WixStyleReactProvider.js.map