This repository has been archived by the owner on Feb 29, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Bug 1432676 - Create AS Router UI Surface / template for Onboarding
overlay
- Loading branch information
Showing
15 changed files
with
627 additions
and
29 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
30 changes: 30 additions & 0 deletions
30
system-addon/content-src/asrouter/components/ModalOverlay/ModalOverlay.jsx
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,30 @@ | ||
import React from "react"; | ||
|
||
export class ModalOverlay extends React.PureComponent { | ||
componentWillMount() { | ||
this.setState({active: true}); | ||
document.body.classList.add("modal-open"); | ||
} | ||
|
||
componentWillUnmount() { | ||
document.body.classList.remove("modal-open"); | ||
this.setState({active: false}); | ||
} | ||
|
||
render() { | ||
const {active} = this.state; | ||
const {title, button_label} = this.props; | ||
return ( | ||
<div> | ||
<div className={`modalOverlayOuter ${active ? "active" : ""}`} /> | ||
<div className={`modalOverlayInner ${active ? "active" : ""}`}> | ||
<h2> {title} </h2> | ||
{this.props.children} | ||
<div className="footer"> | ||
<button onClick={this.props.onDoneButton} className="button primary modalButton"> {button_label} </button> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} |
93 changes: 93 additions & 0 deletions
93
system-addon/content-src/asrouter/components/ModalOverlay/_ModalOverlay.scss
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,93 @@ | ||
.activity-stream { | ||
&.modal-open { | ||
overflow: hidden; | ||
} | ||
} | ||
.modalOverlayOuter { | ||
background: $white; | ||
opacity: 0.93; | ||
height: 100%; | ||
position: fixed; | ||
top: 0; | ||
width: 100%; | ||
display: none; | ||
z-index: 100000; | ||
|
||
&.active { | ||
display: block; | ||
} | ||
} | ||
|
||
.modalOverlayInner { | ||
width: 960px; | ||
height: 510px; | ||
position: fixed; | ||
top: calc(50% - 255px); // halfway down minus half the height of the modal | ||
left: calc(50% - 480px); // halfway across minus half the width of the modal | ||
background: $white; | ||
box-shadow: 0 1px 15px 0 $black-30; | ||
border-radius: 4px; | ||
display: none; | ||
z-index: 100001; | ||
|
||
|
||
// modal takes over entire screen | ||
@media(max-width: 960px) { | ||
width: 100%; | ||
height: 100%; | ||
top: 0; | ||
left: 0; | ||
box-shadow: none; | ||
border-radius: none; | ||
} | ||
|
||
// if modal is short enough, add a vertical scroll bar | ||
@media(max-width: 850px) and (max-height: 730px) { | ||
overflow-y: scroll; | ||
} | ||
|
||
&.active { | ||
display: block; | ||
} | ||
|
||
h2 { | ||
color: $grey-60; | ||
text-align: center; | ||
font-weight: 200; | ||
margin-top: 30px; | ||
font-size: 28px; | ||
line-height: 37px; | ||
letter-spacing: -0.13px; | ||
|
||
@media(max-width: 960px) { | ||
margin-top: 100px; | ||
} | ||
|
||
@media(max-width: 850px) { | ||
margin-top: 30px; | ||
} | ||
} | ||
|
||
.footer { | ||
border-top: 1px solid $grey-30; | ||
height: 70px; | ||
width: 100%; | ||
position: absolute; | ||
bottom: 0; | ||
text-align: center; | ||
background-color: $white; | ||
|
||
// if modal is short enough, footer becomes sticky | ||
@media(max-width: 850px) and (max-height: 730px) { | ||
position: sticky; | ||
} | ||
|
||
.modalButton { | ||
margin-top: 20px; | ||
width: 150px; | ||
height: 30px; | ||
padding: 4px 0 6px 0; | ||
font-size: 15px; | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
system-addon/content-src/asrouter/templates/OnboardingMessage/OnboardingMessage.jsx
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,48 @@ | ||
import {ModalOverlay} from "../../components/ModalOverlay/ModalOverlay"; | ||
import React from "react"; | ||
|
||
class OnboardingCard extends React.PureComponent { | ||
constructor(props) { | ||
super(props); | ||
this.onClick = this.onClick.bind(this); | ||
} | ||
|
||
onClick() { | ||
const {props} = this; | ||
props.sendUserActionTelemetry({event: "TRY_NOW", message_id: props.id}); | ||
props.onAction(props.content); | ||
} | ||
|
||
render() { | ||
const {content} = this.props; | ||
return ( | ||
<div className="onboardingMessage"> | ||
<img src={`resource://activity-stream/data/content/assets/illustration-${content.icon}@2x.png`} /> | ||
<div className="onboardingContent"> | ||
<span> | ||
<h3> {content.title} </h3> | ||
<p> {content.text} </p> | ||
</span> | ||
<span> | ||
<button className="button onboardingButton" onClick={this.onClick}> {content.button_label} </button> | ||
</span> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export class OnboardingMessage extends React.PureComponent { | ||
render() { | ||
const {props} = this; | ||
return ( | ||
<ModalOverlay {...props} button_label={"Start Browsing"} title={"Welcome to Firefox"}> | ||
<div className="onboardingMessageContainer"> | ||
{props.bundle.map(message => ( | ||
<OnboardingCard key={message.id} sendUserActionTelemetry={props.sendUserActionTelemetry} onAction={props.onAction} {...message} /> | ||
))} | ||
</div> | ||
</ModalOverlay> | ||
); | ||
} | ||
} |
Oops, something went wrong.