Skip to content

Commit f010e31

Browse files
authored
Merge pull request #2670 from sciencehistory/video_icon_thumb_overlay
Video work thumbs have a video icon overlay
2 parents fe334de + 1160b41 commit f010e31

File tree

4 files changed

+39
-3
lines changed

4 files changed

+39
-3
lines changed

app/components/search_result/base_component.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="scihist-results-list-item-thumb">
55
<%# hide redundant thumb link from assitive tech
66
https://www.sarasoueidan.com/blog/keyboard-friendlier-article-listings/. -%>
7-
<%= link_to link_to_href, tabindex: "-1", "aria-hidden" => "true" do %>
7+
<%= link_to link_to_href, tabindex: "-1", "aria-hidden" => "true", class: ("img-wrapper-video-icon" if model.leaf_representative&.content_type&.start_with?("video/")) do %>
88
<%= thumbnail_html %>
99
<% end %>
1010
<%= display_num_children_and_extent %>

app/components/work_show_info_component.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195
<% related_or_more_like_this_works.each do |work| %>
196196
<li class="related-work">
197197
<div class="related-work-thumb">
198-
<%= link_to work_path(work.friendlier_id) do %>
198+
<%= link_to work_path(work.friendlier_id), class: ("img-wrapper-video-icon" if work.leaf_representative.content_type.start_with?("video/")) do %>
199199
<%= render ThumbComponent.new(work.leaf_representative, thumb_size: :standard, lazy: true) %>
200200
<% end %>
201201
</div>

app/frontend/stylesheets/local/site_wide.scss

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,3 +301,39 @@ hr.brand {
301301
color: white;
302302
}
303303
}
304+
305+
// Add to a WRAPPER class around an image to add a video icon overlay
306+
.img-wrapper-video-icon {
307+
position: relative;
308+
display: block;
309+
&:after {
310+
position: absolute;
311+
content: "";
312+
313+
// center it
314+
// top: 50%;
315+
// left: 50%;
316+
// translate: -50% -50%;
317+
318+
319+
// nah, bottom right
320+
bottom: min(6%, 0.5rem);
321+
right: min(6%, 0.5rem);
322+
323+
324+
// a square between min and max, or 50% of width of wrapper
325+
width: clamp(1.5rem, 40%, 3rem);
326+
aspect-ratio: 1;
327+
328+
// image from bootstrap icons https://icons.getbootstrap.com/icons/camera-reels-fill/
329+
// https://github.com/twbs/bootstrap/blob/main/LICENSE
330+
// removed height/width, specified color, converted to css url at https://www.svgbackgrounds.com/tools/svg-to-css/
331+
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="black" viewBox="0 0 16 16"><path d="M6 3a3 3 0 1 1-6 0 3 3 0 0 1 6 0"/><path d="M9 6a3 3 0 1 1 0-6 3 3 0 0 1 0 6"/><path d="M9 6h.5a2 2 0 0 1 1.983 1.738l3.11-1.382A1 1 0 0 1 16 7.269v7.462a1 1 0 0 1-1.406.913l-3.111-1.382A2 2 0 0 1 9.5 16H2a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z"/></svg>');
332+
background-position: center;
333+
background-size: 75%;
334+
background-repeat: no-repeat;
335+
336+
background-color: white;
337+
opacity: 0.7;
338+
}
339+
}

app/views/homepage/_recent_items.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<div class="recent-items-list">
77
<% RecentItems.new.recent_items.each do |work| %>
88
<%= link_to work_path(work.friendlier_id), class: "recent-item" do %>
9-
<div class="image-wrapper">
9+
<div class="image-wrapper <%= "img-wrapper-video-icon" if work.leaf_representative&.content_type&.start_with?("video/")%>">
1010
<%= render ThumbComponent.new(
1111
work.leaf_representative,
1212
thumb_size: :standard,

0 commit comments

Comments
 (0)