mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-26 06:47:17 +10:00
Pass translations to ReusableMapContainer in props
This commit is contained in:
parent
0abb0f7cef
commit
aa4ff59618
3 changed files with 7 additions and 2 deletions
|
|
@ -1,9 +1,8 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { node, string } from 'prop-types';
|
||||
import { node, string, object } from 'prop-types';
|
||||
import mapValues from 'lodash/mapValues';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import messages from '../../translations/en.json';
|
||||
import config from '../../config';
|
||||
|
||||
import css from './SearchMap.css';
|
||||
|
|
@ -62,6 +61,7 @@ class ReusableMapContainer extends React.Component {
|
|||
const renderChildren = () => {
|
||||
const isTestEnv = process.env.NODE_ENV === 'test';
|
||||
|
||||
const messages = this.props.messages;
|
||||
// Locale should not affect the tests. We ensure this by providing
|
||||
// messages with the key as the value of each message.
|
||||
const testMessages = mapValues(messages, (val, key) => key);
|
||||
|
|
@ -128,6 +128,7 @@ ReusableMapContainer.propTypes = {
|
|||
children: node.isRequired,
|
||||
className: string,
|
||||
reusableMapHiddenHandle: string.isRequired,
|
||||
messages: object.isRequired,
|
||||
};
|
||||
|
||||
export default ReusableMapContainer;
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ export class SearchMapComponent extends Component {
|
|||
zoom,
|
||||
mapsConfig,
|
||||
activeListingId,
|
||||
messages,
|
||||
} = this.props;
|
||||
const classes = classNames(rootClassName || css.root, className);
|
||||
|
||||
|
|
@ -169,6 +170,7 @@ export class SearchMapComponent extends Component {
|
|||
className={reusableContainerClassName}
|
||||
reusableMapHiddenHandle={REUSABLE_MAP_HIDDEN_HANDLE}
|
||||
onReattach={forceUpdateHandler}
|
||||
messages={messages}
|
||||
>
|
||||
<SearchMapWithMapbox
|
||||
className={classes}
|
||||
|
|
@ -225,6 +227,7 @@ SearchMapComponent.propTypes = {
|
|||
onMapMoveEnd: func.isRequired,
|
||||
zoom: number,
|
||||
mapsConfig: object,
|
||||
messages: object.isRequired,
|
||||
|
||||
// from withRouter
|
||||
history: shape({
|
||||
|
|
|
|||
|
|
@ -234,6 +234,7 @@ export class SearchPageComponent extends Component {
|
|||
onCloseAsModal={() => {
|
||||
onManageDisableScrolling('SearchPage.map', false);
|
||||
}}
|
||||
messages={intl.messages}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue