-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4594 from appirio-tech/dev
Universal Nav implementation
- Loading branch information
Showing
22 changed files
with
220 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,35 @@ | ||
import React from 'react' | ||
//import MenuBar from 'appirio-tech-react-components/components/MenuBar/MenuBar' | ||
import moment from 'moment' | ||
import MediaQuery from 'react-responsive' | ||
//import FooterV2 from '../FooterV2/FooterV2' | ||
import { NEW_PROJECT_PATH, SCREEN_BREAKPOINT_MD } from '../../config/constants' | ||
|
||
require('./Footer.scss') | ||
|
||
const Footer = () => { | ||
const currentYear = moment().format('YYYY') | ||
/*const otherNavigationItems = [ | ||
{img: '', text: 'Aboutss', link: 'https://www.topcoder.com/company/', target: '_blank'}, | ||
{img: '', text: 'Contact us', link: 'https://www.topcoder.com/contact-us/', target: '_blank'}, | ||
{img: '', text: 'Privacy', link: 'https://www.topcoder.com/privacy-policy/', target: '_blank'}, | ||
{img: '', text: 'Terms', link: 'https://connect.topcoder.com/terms', target: '_blank'}, | ||
{img: '', text: 'Our Process', link: 'https://www.topcoder.com/solutions/how-it-works/', target: '_blank'} | ||
]*/ | ||
const isProjectDetails = /projects\/\d+/.test(window.location.pathname) | ||
const isCreateProject = window.location.pathname.startsWith(NEW_PROJECT_PATH) | ||
const isNotificationsPage = window.location.pathname.startsWith('/notifications') | ||
const isSettingsPage = window.location.pathname.startsWith('/settings/') | ||
|
||
// TODO this looks like a bad way of doing it, I think it should be re-factored | ||
const shouldHideOnDesktop = isProjectDetails || isCreateProject || isNotificationsPage || isSettingsPage | ||
|
||
return ( | ||
<MediaQuery minWidth={SCREEN_BREAKPOINT_MD}> | ||
{(matches) => { | ||
if (matches) { | ||
return (shouldHideOnDesktop ? null : | ||
<div className="Footer"> | ||
<p className="copyright-notice">© Topcoder { currentYear }</p> | ||
{/*<div className="footer-menu"> | ||
<MenuBar items={otherNavigationItems} orientation="horizontal" mobileBreakPoint={SCREEN_BREAKPOINT_MD - 1} /> | ||
</div>*/} | ||
</div> | ||
) | ||
} else { | ||
{/* never show footer on mobile */} | ||
return null | ||
} | ||
}} | ||
</MediaQuery> | ||
) | ||
/* global tcUniNav */ | ||
import React, { Component } from 'react' | ||
|
||
import './styles.scss' | ||
|
||
let uniqueId = 0 | ||
|
||
class Footer extends Component { | ||
constructor(props) { | ||
super(props) | ||
uniqueId += 1 | ||
this.footerIdRef = uniqueId | ||
this.uniNavInitialized = false | ||
} | ||
|
||
componentDidMount() { | ||
if (!!this.footerIdRef && !this.uniNavInitialized) { | ||
this.uniNavInitialized = true | ||
tcUniNav('init', `footerNav-${this.footerIdRef}`, { | ||
fullFooter: false, | ||
type: 'footer', | ||
}) | ||
} | ||
} | ||
|
||
render() { | ||
return <div styleName="footer-conatiner" id={`footerNav-${this.footerIdRef}`} /> | ||
} | ||
} | ||
|
||
Footer.propTypes = {} | ||
|
||
Footer.defaultProps = {} | ||
|
||
export default Footer |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@import '~tc-ui/src/styles/tc-includes'; | ||
|
||
.footer-conatiner { | ||
display: flex; | ||
width: 100%; | ||
|
||
footer { | ||
width: 100%; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* global tcUniNav */ | ||
import React, { Component } from 'react' | ||
import PropTypes from 'prop-types' | ||
import { | ||
HEADER_AUTH_URLS_HREF, | ||
HEADER_AUTH_URLS_LOCATION, | ||
DOMAIN, | ||
} from '../../config/constants' | ||
|
||
const HEADER_AUTH_URLS = { | ||
href: HEADER_AUTH_URLS_HREF, | ||
location: HEADER_AUTH_URLS_LOCATION, | ||
} | ||
const BASE = `https://www.${DOMAIN}` | ||
|
||
let uniqueId = 0 | ||
|
||
class NavBar extends Component { | ||
constructor(props) { | ||
super(props) | ||
uniqueId += 1 | ||
this.headerIdRef = uniqueId | ||
this.uniNavInitialized = false | ||
} | ||
|
||
componentDidMount() { | ||
if (!!this.headerIdRef && !this.uniNavInitialized) { | ||
this.uniNavInitialized = true | ||
const headerId = this.headerIdRef | ||
const authURLs = HEADER_AUTH_URLS | ||
|
||
const regSource = window.location.pathname.split('/')[1] | ||
const retUrl = encodeURIComponent(window.location.href) | ||
tcUniNav('init', `headerNav-${headerId}`, { | ||
type: 'tool', | ||
toolName: 'Connect', | ||
toolRoot: '/', | ||
user: 'auto', | ||
signOut: () => { | ||
window.location = `${BASE}/logout?ref=nav` | ||
}, | ||
signIn: () => { | ||
window.location = `${authURLs.location | ||
.replace('%S', retUrl) | ||
.replace('member?', '#!/member?')}®Source=${regSource}` | ||
}, | ||
signUp: () => { | ||
window.location = `${authURLs.location | ||
.replace('%S', retUrl) | ||
.replace( | ||
'member?', | ||
'#!/member?' | ||
)}&mode=signUp®Source=${regSource}` | ||
}, | ||
}) | ||
} | ||
} | ||
|
||
render() { | ||
return <div id={`headerNav-${this.headerIdRef}`} /> | ||
} | ||
} | ||
|
||
NavBar.propTypes = { | ||
user : PropTypes.object, | ||
} | ||
|
||
NavBar.defaultProps = {} | ||
|
||
export default NavBar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.