Skip to content

Commit

Permalink
Load thumbnail in window
Browse files Browse the repository at this point in the history
Co-Authored-By: Jack Reed <[email protected]>
  • Loading branch information
camillevilla and mejackreed committed Oct 24, 2018
1 parent a20e9cb commit 4af441c
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions minimal_redux_poc/src/components/Window.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,35 @@ class Window extends Component {
*/
render() {
return (
<div
className="mirador-window"
>
{this.props.window.id}
<div className="mirador-window">
<h3>{this.props.manifest.manifestation.getLabel().map(label => label.value)[0]}</h3>
<img src={this.props.manifest.manifestation.getThumbnail().id} alt="" />
<p>{this.props.window.id}</p>
</div>
);
}
}

Window.propTypes = {
window: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
manifest: PropTypes.object, // eslint-disable-line react/forbid-prop-types
};

Window.defaultProps = {
manifest: null,
};

/**
* mapStateToProps - used to hook up connect to action creators
* @memberof Window
* @private
*/
const mapStateToProps = ({ windows }, props) => (
{
window: windows.find(window => props.id === window.id),
}
);
const mapStateToProps = ({ windows, manifests }, props) => {
const window = windows.find(win => props.id === win.id);
return {
window,
manifest: manifests[window.manifestId],
};
};

export default connect(mapStateToProps)(Window);

0 comments on commit 4af441c

Please sign in to comment.