This repository has been archived by the owner on Jan 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 128
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 #4821 from punamdahiya/4685-header
Fixes #4685 - [FxA] Common Header Component
- Loading branch information
Showing
30 changed files
with
677 additions
and
558 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const React = require("react"); | ||
const PropTypes = require("prop-types"); | ||
const { Localized } = require("fluent-react/compat"); | ||
|
||
exports.Header = function Header(props) { | ||
const logo = props.hasLogo ? <div className="logo"> | ||
<Localized id="screenshotsLogo"> | ||
<a href="/" title="Screenshots home" className="screenshots-logo"></a> | ||
</Localized> | ||
</div> : null; | ||
|
||
return <header className="header-panel default-color-scheme"> | ||
{logo} | ||
{props.children} | ||
</header>; | ||
}; | ||
|
||
exports.Header.propTypes = { | ||
hasLogo: PropTypes.bool, | ||
children: PropTypes.node.isRequired, | ||
}; |
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,52 @@ | ||
const React = require("react"); | ||
const PropTypes = require("prop-types"); | ||
const { Localized } = require("fluent-react/compat"); | ||
const { SignInButton } = require("../../signin-button.js"); | ||
const sendEvent = require("../../browser-send-event.js"); | ||
const { Header } = require("../../header.js"); | ||
|
||
exports.HomePageHeader = class HomePageHeader extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
} | ||
|
||
onClickMyShots() { | ||
sendEvent("goto-myshots", "homepage", {useBeacon: true}); | ||
} | ||
|
||
renderFxASignIn() { | ||
return ( | ||
this.props.isFirefox && this.props.isOwner ? | ||
<SignInButton isAuthenticated={this.props.hasFxa} initialPage="" /> : null | ||
); | ||
} | ||
|
||
render() { | ||
let myShots; | ||
if (this.props.isOwner) { | ||
myShots = <Localized id="shotIndexPageMyShotsButton"> | ||
<a className="nav-button icon-shots" title="My Shots" href="/shots" onClick={ this.onClickMyShots.bind(this) } tabIndex="0"> | ||
<Localized id="gMyShots"> | ||
<span>My Shots</span> | ||
</Localized> | ||
</a> | ||
</Localized>; | ||
} | ||
|
||
const signin = this.renderFxASignIn(); | ||
return ( | ||
<Header hasLogo={true}> | ||
<div className="alt-actions"> | ||
{ myShots } | ||
{ signin } | ||
</div> | ||
</Header> | ||
); | ||
} | ||
}; | ||
|
||
exports.HomePageHeader.propTypes = { | ||
hasFxa: PropTypes.bool, | ||
isOwner: PropTypes.bool, | ||
isFirefox: PropTypes.bool, | ||
}; |
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.