Skip to content
Snippets Groups Projects
Select Git revision
  • 8f9975368316414e8c46a301b4eba1b980ef5f67
  • master default protected
  • dev
3 results

article.php

Blame
  • AttributionPanel.js 1.29 KiB
    import { compose } from 'redux';
    import { connect } from 'react-redux';
    import { withTranslation } from 'react-i18next';
    import { withStyles } from '@material-ui/core/styles';
    import { withPlugins } from '../extend/withPlugins';
    import {
      getManifestLogo,
      getRequiredStatement,
      getRights,
    } from '../state/selectors';
    import { AttributionPanel } from '../components/AttributionPanel';
    
    /**
     * mapStateToProps - to hook up connect
     * @memberof WindowSideBarInfoPanel
     * @private
     */
    const mapStateToProps = (state, { id, windowId }) => ({
      manifestLogo: getManifestLogo(state, { windowId }),
      requiredStatement: getRequiredStatement(state, { windowId }),
      rights: getRights(state, { windowId }),
    });
    
    /**
     *
     * @param theme
     * @returns {label: {paddingLeft: number}}}
     */
    const styles = theme => ({
      logo: {
        maxWidth: '100%',
      },
      placeholder: {
        backgroundColor: theme.palette.grey[300],
      },
      section: {
        borderBottom: `.5px solid ${theme.palette.section_divider}`,
        paddingBottom: theme.spacing(1),
        paddingLeft: theme.spacing(2),
        paddingRight: theme.spacing(1),
        paddingTop: theme.spacing(2),
      },
    });
    
    const enhance = compose(
      withStyles(styles),
      withTranslation(),
      connect(mapStateToProps),
      withPlugins('AttributionPanel'),
    );
    
    export default enhance(AttributionPanel);