Skip to content
Snippets Groups Projects
Commit 3d1ad37f authored by Chris Beer's avatar Chris Beer
Browse files

Remove unused WindowIcon class

parent 5f7ab4ae
No related branches found
No related tags found
No related merge requests found
import React from 'react';
import { shallow } from 'enzyme';
import WindowIcon from '../../../src/components/WindowIcon';
/** createWrapper */
function createWrapper(props) {
return shallow(
<WindowIcon
manifestLogo=""
classses={{}}
{...props}
/>,
).dive(); // to unwrap HOC created by withStyles();
}
describe('WindowIcon', () => {
it('should render nothing if no manifest logo given', () => {
const wrapper = createWrapper();
expect(wrapper.find('img').length).toBe(0);
});
it('should render logo if manifest logo is given', () => {
const manifestLogo = 'http://foo.bar';
const wrapper = createWrapper({ manifestLogo });
expect(wrapper.find('img').first().prop('src'))
.toEqual(manifestLogo);
});
});
......@@ -7,7 +7,6 @@ import Typography from '@material-ui/core/Typography';
import ReactPlaceholder from 'react-placeholder';
import { TextBlock, TextRow, RectShape } from 'react-placeholder/lib/placeholders';
import ManifestListItemError from '../containers/ManifestListItemError';
import WindowIcon from '../containers/WindowIcon';
import ns from '../config/css-ns';
import 'react-placeholder/lib/reactPlaceholder.css';
......
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
/**
*/
class WindowIcon extends Component {
/**
* render
* @return
*/
render() {
const { manifestLogo, classes } = this.props;
const img = manifestLogo && (
<img
src={manifestLogo}
alt=""
role="presentation"
className={classes.logo}
/>
);
return (
<>
{img}
</>
);
}
}
WindowIcon.propTypes = {
manifestLogo: PropTypes.string,
classes: PropTypes.shape({ logo: PropTypes.string }).isRequired,
};
WindowIcon.defaultProps = {
manifestLogo: null,
};
const styles = {
logo: {
height: '2.5rem',
paddingRight: 8,
},
};
export default withStyles(styles)(WindowIcon);
import { connect } from 'react-redux';
import { withStyles } from '@material-ui/core';
import { compose } from 'redux';
import { getManifestLogo } from '../state/selectors';
import WindowIcon from '../components/WindowIcon';
/** */
const mapStateToProps = (state, { manifestId }) => ({
manifestLogo: getManifestLogo(state.manifests[manifestId]),
});
const styles = {
logo: {
height: '2.5rem',
paddingRight: 8,
},
};
const enhance = compose(
withStyles(styles),
connect(mapStateToProps),
);
export default enhance(WindowIcon);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment