Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
use background contain for feedapp previews (bug 1029765)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngokevin committed Jun 25, 2014
1 parent fd1a874 commit 5c95057
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
9 changes: 0 additions & 9 deletions hearth/media/css/feed.styl
Expand Up @@ -111,22 +111,13 @@ $vertical-tile-margin = 10px;
.desc {
margin: -20px 0 0;
padding: 15px 0 0;

+ img {
margin-top: 10px;
}
}
.feed-app-preview-container {
border-radius: 0 0 5px 5px;
overflow: hidden;
margin: 15px 0 -16px -10px;
height: 150px;
width: $mobile-tile-width;

.feed-app-preview {
width: 100%;
height: auto;
}
}
}
.tile-footer {
Expand Down
9 changes: 6 additions & 3 deletions hearth/templates/_macros/market_tile.html
Expand Up @@ -116,9 +116,12 @@ <h3 class="elliflow" itemprop="name">{{ app.name|translate(app) }}</h3>
{% if feed_app.description %}
<p class="desc">{{ feed_app.description }}</p>
{% endif %}
<div class="feed-app-preview-container">
<img class="feed-app-preview" src="{{ feed_app.preview.image_url }}">
</div>
<div class="feed-app-preview-container"
style="background-color: {{ feed_app.background_color }};
background-image: url({{ feed_app.preview.image_url }});

This comment has been minimized.

Copy link
@cvan

cvan Jun 25, 2014

Contributor

you'll want to escape the URLs so spaces and quotation marks work (you can use |json I think)

background-position: center center;

This comment has been minimized.

Copy link
@cvan

cvan Jun 25, 2014

Contributor

why on earth is this an inline style? and why not use the background shorthand?

This comment has been minimized.

Copy link
@cvan

cvan Jun 25, 2014

Contributor

you can use just one center

This comment has been minimized.

Copy link
@ngokevin

ngokevin Jun 25, 2014

Author Contributor

Oops, the last three rules should be inline.

Don't know if I can use the background shorthand when I need the bg-color + bg-image inline.

This comment has been minimized.

Copy link
@cvan

cvan Jun 25, 2014

Contributor

keep background and background-size in your stylesheet. then change the -color and -image: http://jsbin.com/fonac/1/

inline styles aren't the worst things ever but you are adding specificity that might cause issues later.

background-repeat: no-repeat;
background-size: contain;"></div>
{% endif %}
</div>
{% endmacro %}

0 comments on commit 5c95057

Please sign in to comment.