UNPKG

wix-style-react

Version:
30 lines (23 loc) 962 B
import React from 'react'; import PropTypes from 'prop-types'; import { WixStyleReactEnvironmentContext } from './context'; /** A wrapper component for an app to hold cross library global configuration such as locale, rtl and others */ const WixStyleReactEnvironmentProvider = ({ locale, children }) => { return ( <WixStyleReactEnvironmentContext.Provider value={{ locale }}> {children} </WixStyleReactEnvironmentContext.Provider> ); }; WixStyleReactEnvironmentProvider.displayName = 'WixStyleReactEnvironmentProvider'; WixStyleReactEnvironmentProvider.propTypes = { /** Define the user locale to be used and effect some translation and localization (like DatePicker) - this should be compliant to Intl language codes*/ locale: PropTypes.string, /** any content to be displayed */ children: PropTypes.node, }; WixStyleReactEnvironmentProvider.defaultProps = { locale: 'en', }; export default WixStyleReactEnvironmentProvider;