SHARE
TWEET

Untitled

a guest Feb 21st, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { Component } from 'react';
  2. import PropTypes from 'prop-types';
  3. import connect from 'react-redux/es/connect/connect';
  4.  
  5. import collapsible from 'components/common/hoc/collapsible';
  6. import dateUtils from 'utils/date';
  7. import Feature from 'components/common/feature';
  8. import { fetchPlayersAbroad } from 'redux/actions/players-abroad';
  9.  
  10. import PlayersListContainer from './players-list-container';
  11.  
  12. const baseApiUrl = `/players-abroad`;
  13.  
  14. class PlayersAbroadWrapper extends Component {
  15.     render() {
  16.         const { isCollapsed, onCollapsibleClick, sport } = this.props;
  17.  
  18.         if (sport !== 'football') {
  19.             return null;
  20.         }
  21.  
  22.         return (
  23.             <Feature name="players-abroad">
  24.                 <div className="schedule-tournament">
  25.                     <div
  26.                         onClick={onCollapsibleClick}
  27.                         className="schedule-tournament-header players-abroad-header collapsible-header"
  28.                     >
  29.                         <i className="players-abroad-icon" />
  30.                         <div className="tournament-name players-abroad-name">Norske spillere i utlandet</div>
  31.                     </div>
  32.                     {!isCollapsed && (
  33.                         <PlayersListContainer
  34.                             baseApiUrl={baseApiUrl}
  35.                             date={dateUtils.formatDatetimeWithTimezone(`${this.props.date}T12:00:00`)}
  36.                             fetchPlayersAbroad={fetchPlayersAbroad}
  37.                         />
  38.                     )}
  39.                 </div>
  40.             </Feature>
  41.         );
  42.     }
  43. }
  44.  
  45. PlayersAbroadWrapper.propTypes = {
  46.     date: PropTypes.string.isRequired,
  47.     onCollapsibleClick: PropTypes.func,
  48.     isCollapsed: PropTypes.bool,
  49.     sport: PropTypes.string
  50. };
  51.  
  52. function mapState(state) {
  53.     const { players } = state;
  54.     return {
  55.         players
  56.     };
  57. }
  58.  
  59. export default collapsible(
  60.     connect(
  61.         mapState,
  62.         { fetchPlayersAbroad }
  63.     )(PlayersAbroadWrapper),
  64.     () => 'players-abroad'
  65. );
  66.  
  67. // export default collapsible(PlayersAbroadWrapper, () => 'players-abroad');
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top