8000 Play icon for homepage featured video post thumbnail by benlk · Pull Request #923 · WPBuddy/largo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Play icon for homepage featured video post thumbnail #923

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

Merged
merged 14 commits into from
Nov 3, 2015

Conversation

benlk
Copy link
Collaborator
@benlk benlk commented Oct 9, 2015

Changes

The full-width image template gains as a class the output of largo_hero_class(), which is .is-video for posts with the featured video embed option.

The .is-video class gains a black background and a white triangle background for the play button.

screen shot 2015-10-09 at 4 36 02 pm

The img inside .is-video becomes 50% transparent, to show the white background.

This also incorporates #922 for #921, forcing the .home-top div to 100% the width of its container. This is only used on the Single template and its derivatives.

Why

For #836 and WE-15

Questions:

  • How does the image need to change?
  • Do other thumbnails elsewhere require this treatment? (See this comment for a list.) There are thumbnails on the homepage and not on the homepage.
  • Do any child themes style .is-video for something else?
  • Do any child themes style .home-top for something else?

Possible effects on child themes:

Are they using the .home-top class for something else? This is a very-low-specificity selector, so it will probably be overriden by a child theme's more-specific selectors, and in any case the child theme's CSS is loaded after Largo, so it would override .home-top's width if the child theme set the width.

Any lower-specificity-score selector is going to be using an element name.

In the event that there's a competing class applied to the same element by a child theme, I think the child theme's class's width would take priority, though I'm not sure about the relative scoring of a same-weight selector applied to the same element from a later, overriding stylesheet.

benlk added 6 commits October 8, 2015 15:34
…the CSS2.1 and CSS3 specs do not define how they operate with <img>

And therefore, browsers don't display ::before or ::after on an <img>.
So much for this approach, which would put the play icon as an svg behind the image.
@benlk
Copy link
Collaborator Author
benlk commented Oct 9, 2015

Using this grep command, I found no child theme PHP, CSS or LESS files using .home-top or .is-video.

@aschweigert
Copy link

@benlk I'm actually not sure we need/want this for the top story in this homepage layout. There are a number of issues that could come up with the except/headline box covering the icon and making it look jumbled and things like that so It's probably better to just use the play icon for smaller images. Ryan built a solution for this for another site that you might want to reference (just so we're consistent in our implementation), see: https://bitbucket.org/projectlargo/theme-gijn-impact/src/5afe5a76b2153e510f193804ce5047b510544e8c/less/style.less?at=master&fileviewer=file-view-default#style.less-191

@benlk
Copy link
Collaborator Author
benlk commented Oct 16, 2015

That is a good reason not to use it in the homepage top. I put it there because it was large and a good example of what this would look like, but it can be removed.

Here's a list of other places we use thumbnails:

  • widgets
  • prev/next links (also a widget, but images are probably square now)
  • non-top homepage thumbnails
  • hierarchical archive page featured top and secondary featured posts
  • archive page main area
  • search results

Is there any place other than the homepage top where we would not want the play icon to show up?

The reason I'm not in favor of Ryan's solution is that it adds extra elements to the page, which have positioning requirements and font requirements. This PR makes the image transparent, adds a small inline SVG to the CSS, and uses the SVG as a background on one of the image's parent elements. This doesn't have positioning requirements that could be messed up by child theme CSS.

I'm not sure how easy it would be able to change the appearance of the play icon here in a child theme. It would involve writing a different SVG and inlining it, instead of changing `.play-button-overlay .icon-play::before { content: '\60'; } in Ryan's version. That is a point in favor of Ryan's version.

@benlk
Copy link
Collaborator Author
benlk commented Oct 16, 2015

Mostly, I want to do this in a way that is straight CSS, so we're not adding elements to the page that child themes will have to remove or hide if they don't want the icons.

@aschweigert
Copy link

all of those other places seem fine except maybe the prev/next links, I'd need to see that in context but I think the arrows might actually be confusing in that context (confusion re: prev/next vs. play, that is).

On the CSS thing, I'll defer to @rnagle for a judgment call on that

@aschweigert aschweigert assigned rnagle and unassigned aschweigert Oct 16, 2015
@benlk
Copy link
Collaborator Author
benlk commented Oct 22, 2015
  • move styles from homepage.less into main styles
  • screenshots in other places:
    • category page
    • archive page
    • widgets
    • homepages in the non-top-story
  • IE9 problem: correct the SVG syntax until it works in IE9, because IE9 accepts bacground svgs, but not this one.
    • if changing the markup of the SVG doesn't work, try putting it in its own file and then including the file
    • alternately, create a fallback and then override it with the correct svg. That requires two externals, maybe:
{
  background: url(fallback.png);
  background-image: url(image.svg), none;
}
  • test in Xcode's iOS simulator
  • test in an Android device or the Android simulator or the Chrome passthrough

@aschweigert
Copy link

I'd like to not spend much more time on this at this point. If a lot more testing is necessary, let's go with the non-css version that we know works and then come back to this as an enhancement at a later date.

@benlk
Copy link
Collaborator Author
benlk commented Oct 22, 2015

This doesn't play well with the LESS customizer: #936

The assumption that an a img will be in a containing element not shared with anything else is not valid.

On category archives, it works for the primary post, which is alone in a div.span4:

screen shot 2015-10-22 at 1 39 11 pm

But the a img shares an article with the headlines in the secondary featured posts:

screen shot 2015-10-22 at 1 59 42 pm

I stopped checking after that.

I think this is better than adding the icon-play elements as we did in gijn-impacts's partials, but at this point we're going to be modifying all the partials anyways. CSS is a smaller set of modifications to the partials than the i.icon-play additions, but with adding new elements to the partials for the CSS, both options will require testing with the child themes. 😞

@rnagle
Copy link
rnagle commented Oct 22, 2015

@benlk Instead of embedding the SVG inline, just save an SVG file and load it via url(). That should address the issue with the LESS customizer, right?

If you need to add markup to specific templates or template partials, then do that. For theme's that override a template or partial where markup changes, the icon simply won't show. This seems acceptable in the short-term -- means we can finish this without a lot more testing.

@benlk
Copy link
Collaborator Author
benlk commented Oct 23, 2015

Checked all the places that we use the partials, and where thumbnails are used. Changes noted below.

  • archive.php
  • category.php
  • home.php
  • series-landing.php (but filed Series Landing pages with featured media set should use the featured media instead of the featured thumbnail. #941)
  • single-one-column.php ((Uses a hero partial to grab the media~~
  • single-two-column.php (Doesn't use featured media, that's a different PR)
  • single.php
  • inc/archive-category-primary-feature.php
  • inc/archive-category-related.php
  • inc/archive-category-secondary-feature.php
  • inc/author-bio-description.php
  • inc/author-bio-social-links.php
  • inc/content-not-found.php
  • inc/content-page.php
  • inc/content-series.php
  • inc/content-single-classic.php
  • inc/content-single.php
  • inc/content-tiny.php
    • added white space around the conditionals in this as well, because they were a long mess.
    • added container div and moved the align class for the before-header thumbnail from the img to the div
  • inc/content.php
    • hero class already used on posts in the Homepage Featured tax, added to the non-featured ones.
  • inc/footer-before-footer-widget-area.php
  • inc/footer-boilerplate.php
  • inc/footer-sticky.php
  • inc/footer-widget-1col.php
  • inc/footer-widget-3col-default.php
  • inc/footer-widget-3col-equal.php
  • inc/footer-widget-4col-asymm.php
  • inc/footer-widget-4col.php
  • inc/footer-widget-area.php
  • inc/header-ad-zone.php
  • inc/hero-featured-embed.php
  • inc/hero-featured-gallery.php
  • inc/hero-featured-image.php
  • inc/home-bottom-widget-area.php
  • inc/home-post-list.php
  • inc/homepage-alert.php
  • inc/largo-header.php
  • inc/load-more-posts.php
  • inc/nav-global.php
  • inc/nav-main.php
  • inc/nav-secondary.php
  • inc/nav-sticky.php
  • inc/sidebar-archive.php
  • inc/sidebar-fallback.php
  • inc/sidebar-single.php
  • inc/sidebar.php
  • inc/single-hero.php
    • already taken care of
  • inc/sticky-posts.php

Did you know that partials/content-tiny.php is only used at all in one widget, the Series Posts widget?

@aschweigert
Copy link

Yeah, I noticed that a while ago. Not sure we really need it, to be honest.

rnagle added a commit that referenced this pull request Nov 3, 2015
…yles

Play icon for homepage featured video post thumbnail
@rnagle rnagle merged commit 59cd418 into develop Nov 3, 2015
@benlk benlk deleted the 836-featured-video-thumbnail-play-styles branch February 3, 2016 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0