Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-1273 fix distorted reward image with cover #139

Merged
merged 3 commits into from Jul 19, 2018
Merged
Changes from 1 commit
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

Next
GH-1273 fix distorted reward image with cover
  • Loading branch information
trickpattyFH20 committed Jul 17, 2018
commit 5041e505084c4a285141cda788991933d8504346
@@ -46,6 +46,7 @@ class OfferCard extends Component {
this.iframeEl.classList = '';
this.iframeEl.classList.add('offer-card');
}
this.rewardPictureEl = null;

this.betaLogo = `url(${chrome.extension.getURL('app/images/rewards/ghostery-rewards-beta.png')})`;
this.closeIcon = `url(${chrome.extension.getURL('app/images/drawer/x.svg')})`;
@@ -105,6 +106,11 @@ class OfferCard extends Component {

componentDidMount() {
this.props.actions.addRewardSeenListener();
const bgImg = new Image();
bgImg.onload = () => {
this.rewardPictureEl.style.backgroundImage = `url(${bgImg.src})`;
};
bgImg.src = this.state.rewardUI.picture_url;
}

copyCode() {
@@ -246,7 +252,7 @@ class OfferCard extends Component {
</div>
<div className="reward-content-img">
<div className="flex-grow" />
<img src={this.state.rewardUI.picture_url} className="hide" onLoad={this.handleImageLoaded} />
<div className="img" ref={(node) => { this.rewardPictureEl = node; }} />
<div className="flex-grow" />
</div>
<div className="reward-content-detail">
@@ -107,7 +107,7 @@ class RewardDetail extends React.Component {
<div className="RewardDetail flex-container flex-dir-column align-justify">
<div className="RewardDetail__image_container">
<img className="RewardDetail__logo" src={logoUrl} />
<img className="RewardDetail__picture" src={pictureUrl} />
<div className="RewardDetail__picture" style={{ backgroundImage: `url('${pictureUrl}')` }} />
</div>
{text && (
<div className="RewardDetail__title">
@@ -176,6 +176,9 @@
height: 100%;
width: 100%;
background-color: #efefef;
background-repeat: no-repeat;
background-size: cover;
background-position: center;
}
.RewardDetail__logo {
position: absolute;
@@ -151,15 +151,16 @@

.reward-content-img {
height: 120px;
// margin-top: 8px;
width: 247px;
display: flex;
align-items: center;

img {
width: 100%;
.img {
height: 100%;
object-fit: contain;
width: 100%;
background-repeat: no-repeat;
background-size: cover;
background-position: center;
}
}

@@ -12,6 +12,8 @@
"version_name": "8.2.1",
"default_locale": "en",
"description": "__MSG_short_description__",
"debug": true,
"log": true,
"icons": {
"16": "app/images/icon16.png",
"48": "app/images/icon48.png",
@@ -94,4 +96,4 @@
"app/images/*",
"dist/css/rewards_styles.css"
]
}
}
ProTip! Use n and p to navigate between commits in a pull request.