Advertisement
dfghgfhplkjbv

src/components/Footer/Footer.js

Feb 27th, 2019
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.25 KB | None | 0 0
  1. import React, { Component } from 'react'
  2. import PropTypes from 'prop-types'
  3. import classNames from 'classnames'
  4. import moment from 'moment'
  5. import { Link } from 'gatsby'
  6. import { OutboundLink } from 'gatsby-plugin-google-analytics'
  7. import AnchorLink from 'react-anchor-link-smooth-scroll'
  8. import logo from '../../img/theheroes_logo.svg'
  9. import FacebookIcon from '../svg/FacebookIcon'
  10. import YoutubeIcon from '../svg/YoutubeIcon'
  11. import InstagramIcon from '../svg/InstagramIcon'
  12. import TwitterIcon from '../svg/TwitterIcon'
  13. import { formatMessage } from 'src/translations'
  14. import styles from './Footer.module.scss'
  15. import { isOnline, removeListeners } from 'src/utils'
  16. import { getLink } from 'src/utils'
  17.  
  18. class Footer extends Component {
  19. state = { isOnline: true }
  20.  
  21. componentDidMount() {
  22. isOnline(this)
  23. }
  24.  
  25. componentWillUnmount() {
  26. removeListeners()
  27. }
  28.  
  29. render() {
  30. const { className, locale } = this.props
  31.  
  32. return (
  33. <footer className={classNames(className, styles.root)}>
  34. <div className={styles.row}>
  35. <Link to={getLink(locale)} className={styles.logo}>
  36. <img src={logo} alt="logo" />
  37. <figure>BETA</figure>
  38. </Link>
  39. <nav className={styles.nav}>
  40. <ul>
  41. <li>
  42. <Link to={getLink(locale, 'news')}>{formatMessage(locale, 'news')}</Link>
  43. </li>
  44. <li>
  45. <Link to={getLink(locale, 'interviews')}>{formatMessage(locale, 'interview')}</Link>
  46. </li>
  47.  
  48. {this.state.isOnline && locale !== 'en' ? (
  49. <li>
  50. <Link to={getLink(locale, 'videos')}>{formatMessage(locale, 'video')}</Link>
  51. </li>
  52. ) : (
  53. <li className={styles.offlineMode}>
  54. <Link to={getLink(locale, 'videos')}>{formatMessage(locale, 'video')}</Link>
  55. </li>
  56. )}
  57. </ul>
  58.  
  59. <ul>
  60. {this.state.isOnline && locale !== 'en' ? (
  61. <li>
  62. <Link to={getLink(locale, 'podcasts')}>{formatMessage(locale, 'podcasts')}</Link>
  63. </li>
  64. ) : (
  65. <li className={styles.offlineMode}>
  66. <Link to={getLink(locale, 'podcasts')}>{formatMessage(locale, 'podcasts')}</Link>
  67. </li>
  68. )}
  69.  
  70. <li>
  71. <Link to={getLink(locale, 'about')} locale={locale}>
  72. {formatMessage(locale, 'about')}
  73. </Link>
  74. </li>
  75. <li>
  76. <Link to={getLink(locale, 'contacts')}>{formatMessage(locale, 'contacts')}</Link>
  77. </li>
  78. </ul>
  79. </nav>
  80.  
  81. <ul className={styles.social}>
  82. <li>
  83. <OutboundLink href="/" target="_blank" rel="noreferrer noopener" aria-label="facebook">
  84. <FacebookIcon width="48px" height="48px" />
  85. </OutboundLink>
  86. </li>
  87. <li>
  88. <OutboundLink href="/" target="_blank" rel="noreferrer noopener" aria-label="youtube">
  89. <YoutubeIcon width="48px" height="48px" />
  90. </OutboundLink>
  91. </li>
  92. <li>
  93. <OutboundLink href="/" target="_blank" rel="noreferrer noopener" aria-label="instagram">
  94. <InstagramIcon width="48px" height="48px" />
  95. </OutboundLink>
  96. </li>
  97. <li>
  98. <OutboundLink href="/" target="_blank" rel="noreferrer noopener" aria-label="twitter">
  99. <TwitterIcon width="48px" height="48px" />
  100. </OutboundLink>
  101. </li>
  102. </ul>
  103. </div>
  104.  
  105. <div className={styles.extra}>
  106. <OutboundLink href="https://humanseelabs.com/" className={styles.copyright}>
  107. {moment().year()}, <span>humanseelabs</span>
  108. </OutboundLink>
  109. <AnchorLink href="#header" className={styles.toTop}>
  110. {formatMessage(locale, 'top')}
  111. </AnchorLink>
  112. </div>
  113. </footer>
  114. )
  115. }
  116. }
  117.  
  118. Footer.propTypes = {
  119. className: PropTypes.string,
  120. locale: PropTypes.string.isRequired,
  121. }
  122.  
  123. export default Footer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement