|
1 |
| -import React from 'react' |
2 |
| -//import MenuBar from 'appirio-tech-react-components/components/MenuBar/MenuBar' |
3 |
| -import moment from 'moment' |
4 |
| -import MediaQuery from 'react-responsive' |
5 |
| -//import FooterV2 from '../FooterV2/FooterV2' |
6 |
| -import { NEW_PROJECT_PATH, SCREEN_BREAKPOINT_MD } from '../../config/constants' |
7 |
| - |
8 |
| -require('./Footer.scss') |
9 |
| - |
10 |
| -const Footer = () => { |
11 |
| - const currentYear = moment().format('YYYY') |
12 |
| - /*const otherNavigationItems = [ |
13 |
| - {img: '', text: 'Aboutss', link: 'https://www.topcoder.com/company/', target: '_blank'}, |
14 |
| - {img: '', text: 'Contact us', link: 'https://www.topcoder.com/contact-us/', target: '_blank'}, |
15 |
| - {img: '', text: 'Privacy', link: 'https://www.topcoder.com/privacy-policy/', target: '_blank'}, |
16 |
| - {img: '', text: 'Terms', link: 'https://connect.topcoder.com/terms', target: '_blank'}, |
17 |
| - {img: '', text: 'Our Process', link: 'https://www.topcoder.com/solutions/how-it-works/', target: '_blank'} |
18 |
| - ]*/ |
19 |
| - const isProjectDetails = /projects\/\d+/.test(window.location.pathname) |
20 |
| - const isCreateProject = window.location.pathname.startsWith(NEW_PROJECT_PATH) |
21 |
| - const isNotificationsPage = window.location.pathname.startsWith('/notifications') |
22 |
| - const isSettingsPage = window.location.pathname.startsWith('/settings/') |
23 |
| - |
24 |
| - // TODO this looks like a bad way of doing it, I think it should be re-factored |
25 |
| - const shouldHideOnDesktop = isProjectDetails || isCreateProject || isNotificationsPage || isSettingsPage |
26 |
| - |
27 |
| - return ( |
28 |
| - <MediaQuery minWidth={SCREEN_BREAKPOINT_MD}> |
29 |
| - {(matches) => { |
30 |
| - if (matches) { |
31 |
| - return (shouldHideOnDesktop ? null : |
32 |
| - <div className="Footer"> |
33 |
| - <p className="copyright-notice">© Topcoder { currentYear }</p> |
34 |
| - {/*<div className="footer-menu"> |
35 |
| - <MenuBar items={otherNavigationItems} orientation="horizontal" mobileBreakPoint={SCREEN_BREAKPOINT_MD - 1} /> |
36 |
| - </div>*/} |
37 |
| - </div> |
38 |
| - ) |
39 |
| - } else { |
40 |
| - {/* never show footer on mobile */} |
41 |
| - return null |
42 |
| - } |
43 |
| - }} |
44 |
| - </MediaQuery> |
45 |
| - ) |
| 1 | +/* global tcUniNav */ |
| 2 | +import React, { Component } from 'react' |
| 3 | + |
| 4 | +import './styles.scss' |
| 5 | + |
| 6 | +let uniqueId = 0 |
| 7 | + |
| 8 | +class Footer extends Component { |
| 9 | + constructor(props) { |
| 10 | + super(props) |
| 11 | + uniqueId += 1 |
| 12 | + this.footerIdRef = uniqueId |
| 13 | + this.uniNavInitialized = false |
| 14 | + } |
| 15 | + |
| 16 | + componentDidMount() { |
| 17 | + if (!!this.footerIdRef && !this.uniNavInitialized) { |
| 18 | + this.uniNavInitialized = true |
| 19 | + tcUniNav('init', `footerNav-${this.footerIdRef}`, { |
| 20 | + fullFooter: false, |
| 21 | + type: 'footer', |
| 22 | + }) |
| 23 | + } |
| 24 | + } |
| 25 | + |
| 26 | + render() { |
| 27 | + return <div styleName="footer-conatiner" id={`footerNav-${this.footerIdRef}`} /> |
| 28 | + } |
46 | 29 | }
|
47 | 30 |
|
| 31 | +Footer.propTypes = {} |
| 32 | + |
| 33 | +Footer.defaultProps = {} |
| 34 | + |
48 | 35 | export default Footer
|
0 commit comments