Translating Loader component
This commit is contained in:
parent
d48b48bffc
commit
325f01f034
@ -113,7 +113,7 @@ exports[`App rendering an expression 2`] = `
|
||||
]
|
||||
}
|
||||
/>
|
||||
<Loader />
|
||||
<LoadNamespace(Loader) />
|
||||
</Fragment>
|
||||
`;
|
||||
|
||||
@ -248,7 +248,7 @@ exports[`App rendering with an invalid syntax 2`] = `
|
||||
]
|
||||
}
|
||||
/>
|
||||
<Loader />
|
||||
<LoadNamespace(Loader) />
|
||||
</Fragment>
|
||||
`;
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Loader rendering 1`] = `
|
||||
<Loader>
|
||||
<Loader
|
||||
t={[Function]}
|
||||
>
|
||||
<div
|
||||
className="loader"
|
||||
>
|
||||
@ -73,7 +75,7 @@ exports[`Loader rendering 1`] = `
|
||||
<div
|
||||
className="message"
|
||||
>
|
||||
Loading...
|
||||
TRANSLATE(Loading...)
|
||||
</div>
|
||||
</div>
|
||||
</Loader>
|
||||
|
@ -1,14 +1,21 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { withNamespaces } from 'react-i18next';
|
||||
|
||||
import LoaderIcon from 'react-feather/dist/icons/loader';
|
||||
|
||||
import style from './style.module.css';
|
||||
|
||||
const Loader = () => (
|
||||
const Loader = ({ t }) => (
|
||||
<div className={ style.loader }>
|
||||
<LoaderIcon />
|
||||
<div className={ style.message }>Loading...</div>
|
||||
<div className={ style.message }>{ t('Loading...') }</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
export default Loader;
|
||||
Loader.propTypes = {
|
||||
t: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export { Loader };
|
||||
export default withNamespaces()(Loader);
|
||||
|
@ -1,14 +1,15 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
|
||||
import Loader from 'components/Loader';
|
||||
import { mockT } from 'i18n';
|
||||
import { Loader } from 'components/Loader';
|
||||
|
||||
describe('Loader', () => {
|
||||
test('rendering', () => {
|
||||
// Using full rendering here since styles for this depend on the structure
|
||||
// of the SVG.
|
||||
const component = mount(
|
||||
<Loader />
|
||||
<Loader t={ mockT } />
|
||||
);
|
||||
expect(component).toMatchSnapshot();
|
||||
});
|
||||
|
@ -63,3 +63,5 @@
|
||||
DOWNLOAD SVG
|
||||
"Download PNG": |
|
||||
DOWNLOAD PNG
|
||||
"Loading...": |
|
||||
LOADING...
|
||||
|
@ -63,3 +63,5 @@
|
||||
Download SVG
|
||||
"Download PNG": |
|
||||
Download PNG
|
||||
"Loading...": |
|
||||
Loading...
|
||||
|
Loading…
Reference in New Issue
Block a user