Skip to content
Snippets Groups Projects
Commit 4aa27c32 authored by Andrew Winget (Standard)'s avatar Andrew Winget (Standard)
Browse files

hook up manifest link to redux actions

parent 77a1093c
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
...@@ -4,6 +4,7 @@ import PropTypes from 'prop-types'; ...@@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
import { actions } from '../store'; import { actions } from '../store';
import Display from './Display'; import Display from './Display';
import ManifestForm from './ManifestForm'; import ManifestForm from './ManifestForm';
import ManifestListItem from './ManifestListItem';
/** /**
* This is the top level Mirador component. * This is the top level Mirador component.
...@@ -58,7 +59,10 @@ class App extends Component { ...@@ -58,7 +59,10 @@ class App extends Component {
*/ */
render() { render() {
const manifestList = Object.keys(this.props.manifests).map(manifest => ( const manifestList = Object.keys(this.props.manifests).map(manifest => (
<li key={manifest}>{manifest}</li> <ManifestListItem
key={manifest}
manifest={manifest}
/>
)); ));
return ( return (
<div className="App"> <div className="App">
......
import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import { actions } from '../store';
const handleOpenButtonClick = (event, manifest, addWindow) => {
addWindow({});
}
/**
* Represents an item in a list of currently-loaded or loading manifests
* @param {object} props
* @param {object} [props.manifest = string]
*/
const ManifestListItem = ({ manifest, addWindow}) => (
<li className="manifest-list-item">
<a href="#" onClick={(event) => handleOpenButtonClick(event, manifest, addWindow)}>
{manifest}
</a>
</li>
);
ManifestListItem.propTypes = {
manifest: PropTypes.string.isRequired, // eslint-disable-line react/forbid-prop-types
};
const mapStateToProps = () => (
{}
);
const mapDispatchToProps = dispatch => ({
addWindow: options => (
dispatch(actions.addWindow(options))
),
});
export default connect(
mapStateToProps,
mapDispatchToProps,
)(ManifestListItem);
body { body {
background: lighten(red, 20%); background: white;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment