ClubFullInfo.jsx 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // components
  2. import SubmenuButton from '@ui/SubmenuButton';
  3. import Submenu from '@ui/Submenu';
  4. import TruncatedText from '@components/TruncatedText';
  5. // hooks
  6. import useSubmenu from '@hooks/useSubmenu';
  7. import {useWindowSize} from 'react-use';
  8. import useMeasure from 'react-use-measure';
  9. // utils
  10. import PropTypes from 'prop-types';
  11. const ClubFullInfo = ({club, country, isCompact}) => {
  12. const [nameRef, {width}] = useMeasure();
  13. const {anchorEl, open, handleClick, handleClose} = useSubmenu();
  14. const isSmallScreen = useWindowSize().width < 414;
  15. const isIconOnly = isSmallScreen || isCompact;
  16. const submenuActions = [
  17. {
  18. label: 'Share',
  19. icon: 'share',
  20. },
  21. {
  22. label: 'Follow',
  23. icon: 'follow',
  24. }
  25. ]
  26. return (
  27. <div className="d-flex flex-column g-20">
  28. <div className="club_header d-flex align-items-center g-14">
  29. <img className="club-logo" src={club.logo} alt={club.name}/>
  30. <div className="club_header-main d-flex flex-column g-10 w-100" ref={nameRef}>
  31. <TruncatedText className="h2" text={club.shortName || club.name} lines={1} width={width}/>
  32. <span className="text-12">{club.city}, {country || club.country}</span>
  33. </div>
  34. </div>
  35. <div className="d-flex align-items-center justify-content-between">
  36. <div className={`d-flex ${isIconOnly ? 'g-8' : 'g-16'}`}>
  37. <a className={`tag tag--social h6 ${isIconOnly ? 'compact' : ''}`}
  38. style={{backgroundColor: '#3b5998'}}
  39. href="https://www.facebook.com"
  40. target="_blank"
  41. rel="noopener noreferrer"
  42. aria-label="Facebook"
  43. >
  44. {isIconOnly ? <i className="icon icon-facebook-f"/> : 'Facebook'}
  45. </a>
  46. <a className={`tag tag--social h6 ${isIconOnly ? 'compact' : ''}`}
  47. style={{backgroundColor: '#1da1f2'}}
  48. href="https://www.twitter.com"
  49. target="_blank"
  50. rel="noopener noreferrer"
  51. aria-label="Twitter"
  52. >
  53. {isIconOnly ? <i className="icon icon-twitter"/> : 'Twitter'}
  54. </a>
  55. <a className={`tag tag--social h6 ${isIconOnly ? 'compact' : ''}`}
  56. style={{backgroundColor: '#ff0000'}}
  57. href="https://www.youtube.com"
  58. target="_blank"
  59. rel="noopener noreferrer"
  60. aria-label="Youtube"
  61. >
  62. {isIconOnly ? <i className="icon icon-youtube"/> : 'Youtube'}
  63. </a>
  64. </div>
  65. <SubmenuButton onClick={handleClick}/>
  66. <Submenu anchorEl={anchorEl} open={open} onClose={handleClose} actions={submenuActions}/>
  67. </div>
  68. </div>
  69. )
  70. }
  71. ClubFullInfo.propTypes = {
  72. club: PropTypes.object.isRequired,
  73. country: PropTypes.string,
  74. }
  75. export default ClubFullInfo