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

Redesign media cards #656

Merged
merged 23 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2463192
Make lecture cards more reactive
Splines Jul 1, 2024
3777b02
Fix card header border radius & use blue border color
Splines Jul 1, 2024
d93d56b
Add "hover to play" feature
Splines Jul 1, 2024
a2da9d9
Use bootstrap icons for buttons
Splines Jul 1, 2024
2a285a6
Explicitly set footer background color
Splines Jul 1, 2024
599ae72
Clean up card footer
Splines Jul 1, 2024
4abfc08
Use buttons for media card actions
Splines Jul 1, 2024
94f93cf
Add interactive hover to other sections as well
Splines Jul 1, 2024
f040f04
Improve media grid breakpoints
Splines Jul 1, 2024
a59ea65
Add another horizontal line above card body
Splines Jul 1, 2024
154acb4
Import necessary bootstrap files in `media.scss`
Splines Jul 3, 2024
4236b89
Outline the buttons instead of filling them
Splines Jul 3, 2024
1ab1ceb
Use auto phrasing for card word break
Splines Jul 3, 2024
9768e6b
Let only lecture tags change color on hover
Splines Jul 3, 2024
173ee23
Improve styling of header end icons
Splines Jul 3, 2024
a6812fd
Fix download button alignment
Splines Jul 3, 2024
fc053f7
Revert locale logic change
Splines Jul 3, 2024
e021a47
Make default screenshot more subdued
Splines Jul 3, 2024
94f067d
Reflect media card changes for watchlist cards
Splines Jul 3, 2024
144f37d
Reuse medium card for watchlists
Splines Jul 3, 2024
3784aa1
Adjust card header talk people icon
Splines Jul 3, 2024
cabb828
Wait for turbolinks:load (shining pointer)
Splines Jul 3, 2024
ddd8983
Merge branch 'dev' into feature/cards-glass
Splines Jul 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/assets/javascripts/cards.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
$(document).on("turbolinks:load", function () {
$(".mampf-card").on("mousemove", function (event) {
const { x, y } = this.getBoundingClientRect();
this.style.setProperty("--x", event.clientX - x);
this.style.setProperty("--y", event.clientY - y);
});
});
13 changes: 2 additions & 11 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ $container-max-widths: (
@import "vertices";
@import "trix";

$badge-color: #545b62;

trix-toolbar .trix-button-row {
flex-wrap: wrap;
}
Expand Down Expand Up @@ -267,15 +265,8 @@ a {
}
}

.badge {
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;

&:hover,
&:focus {
text-decoration: none;
background-color: $badge-color !important;
color: white;
}
.badge:hover {
cursor: default;
}

.btn {
Expand Down
7 changes: 6 additions & 1 deletion app/assets/stylesheets/lectures.scss
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,14 @@

.lecture-tag {
background-color: #dae0e5;
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;

&:hover {
&:hover,
&:focus {
text-decoration: none;
background-color: #545b62 !important;
color: white !important;
cursor: pointer !important;
}
}

Expand Down
152 changes: 146 additions & 6 deletions app/assets/stylesheets/media.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
// Place all the styles related to the media controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
@import "bootstrap/functions";
@import "bootstrap/variables";
@import "bootstrap/mixins";

.media-grid {
@include make-col-ready();

@include media-breakpoint-up(sm) {
@include make-col(12);
}

@include media-breakpoint-up(md) {
@include make-col(6);
}

@media (min-width: 1100px) {
@include make-col(4);
}

@media (min-width: 1300px) {
@include make-col(3);
}

@media (min-width: 1700px) {
@include make-col(2.4); // 5 columns
}
}

.hidden {
display: none;
Expand Down Expand Up @@ -28,25 +52,141 @@
display: flex;
justify-content: flex-start;
flex-wrap: wrap;
padding: 0.5rem var(--bs-card-cap-padding-x);
}

.media-card-header {
display: flex;
justify-content: flex-end;
}

.card-header {
.mampf-card-header {
padding: 0.75rem 1.25rem;
background-color: #223e62;
}

.mampf-header-end {
color: $gray-300;

& a {
color: $gray-300;
}
}

.card-footer {
padding: 0.75rem 1.25rem;
padding: 0;
background-color: #21252908;
}

.media-hr {
margin: 0;
}

.card-text-end {
padding: 0.75rem var(--bs-card-cap-padding-x);
}

.media-download-buttons {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: space-around;
margin: 0.25rem;
}

.download-button {
padding: 0 0.5em;
font-size: 0.8em;
height: 1.4em;
border: none;
text-align: left;
line-height: normal;
}

.mampf-card {
border: 2px solid #223e62;
position: relative;
overflow: hidden;
background: linear-gradient(0deg, #ecf1f8 0%, #fcfdfd 60%);
box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 3px;
transition: box-shadow 120ms ease-in-out;

&:hover {
box-shadow: rgba(50, 50, 93, 0.02) 0px 50px 50px -20px,
rgba(0, 0, 0, 0.15) 0px 25px 50px -25px;
}
}

.mampf-card:hover::after {
opacity: 0.12;
}

.mampf-card::after {
content: '';
position: absolute;
width: 160px;
height: 160px;
top: calc(var(--y, 0) * 1px - 80px);
left: calc(var(--x, 0) * 1px - 80px);
opacity: 0;
background: radial-gradient(white, #00000000 80%);
transition: opacity 200ms;
pointer-events: none;
}

.mampf-card-image-wrapper {
overflow: hidden;
display: flex;
justify-content: center;
position: relative;

&:hover .interactive-hover {
visibility: visible;
opacity: 1;
}
}

.mampf-card-image {
margin: -5px; // crop image to not display scroll bars present in some images
width: 100%;
}

.interactive-hover {
width: 100%;
height: 100%;
position: absolute;
display: flex;
justify-content: center;
align-items: center;
background-color: rgba(0, 0, 0, 0.75);
visibility: hidden;
opacity: 0;
transition: visibility 150ms ease-in-out, opacity 150ms ease-in-out;
}

.interactive-hover-icon {
font-size: 2.3em;
color: white;
}

.empty-default-screenshot {
width: 100%;
height: 8em;
background-color: #ffffff;
background-image: linear-gradient(#BCC5CF 2px, transparent 2px), linear-gradient(90deg, #BCC5CF 2px, transparent 2px), linear-gradient(#BCC5CF 1px, transparent 1px), linear-gradient(90deg, #BCC5CF 1px, #ffffff 1px);
background-size: 50px 50px, 50px 50px, 10px 10px, 10px 10px;
background-position: -2px -2px, -2px -2px, -1px -1px, -1px -1px;
}

.card-body {
// same as card-footer border
border-top: var(--bs-card-border-width) solid var(--bs-card-border-color);
}

#media-card-subheader {
display: flex;
justify-content: space-between;
word-break: break-all;
word-break: auto-phrase;
}

#video-wait {
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/talks_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ def speaker_list(talk)
end

def speaker_icon_class(talk)
return "fas fa-user" unless talk.speakers.count > 1
return "bi bi-person-fill" unless talk.speakers.count > 1

"fas fa-users"
"bi bi-people-fill"
end

def speaker_icon(talk)
Expand Down
2 changes: 1 addition & 1 deletion app/views/media/_media.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% if media.present? %>
<div class="row">
<% media.each do |medium| %>
<div class="col-12 col-md-6 col-lg-4 col-xl-3 pb-2">
<div class="media-grid pb-2">
<%= render partial: 'media/medium',
locals: { medium: medium,
tags: tags,
Expand Down
Loading