From 3d1ad37ff4338b5703489335535df9f980181a3a Mon Sep 17 00:00:00 2001 From: Chris Beer <cabeer@stanford.edu> Date: Fri, 15 Mar 2019 10:36:40 -0700 Subject: [PATCH] Remove unused WindowIcon class --- __tests__/src/components/WindowIcon.test.js | 28 ------------ src/components/ManifestListItem.js | 1 - src/components/WindowIcon.js | 48 --------------------- src/containers/WindowIcon.js | 24 ----------- 4 files changed, 101 deletions(-) delete mode 100644 __tests__/src/components/WindowIcon.test.js delete mode 100644 src/components/WindowIcon.js delete mode 100644 src/containers/WindowIcon.js diff --git a/__tests__/src/components/WindowIcon.test.js b/__tests__/src/components/WindowIcon.test.js deleted file mode 100644 index 93a26f5f5..000000000 --- a/__tests__/src/components/WindowIcon.test.js +++ /dev/null @@ -1,28 +0,0 @@ -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); - }); -}); diff --git a/src/components/ManifestListItem.js b/src/components/ManifestListItem.js index 1dc9d800e..473230218 100644 --- a/src/components/ManifestListItem.js +++ b/src/components/ManifestListItem.js @@ -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'; diff --git a/src/components/WindowIcon.js b/src/components/WindowIcon.js deleted file mode 100644 index 63894236f..000000000 --- a/src/components/WindowIcon.js +++ /dev/null @@ -1,48 +0,0 @@ -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); diff --git a/src/containers/WindowIcon.js b/src/containers/WindowIcon.js deleted file mode 100644 index fb31d154a..000000000 --- a/src/containers/WindowIcon.js +++ /dev/null @@ -1,24 +0,0 @@ -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); -- GitLab