Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
thumbnails: Place play button on all media with grid.
Karl Stolleyab24eea83e36
diff --git a/web/styles/rendered_markdown.css b/web/styles/rendered_markdown.cssindex 522ee2894a8..47452f98794 100644--- a/web/styles/rendered_markdown.css+++ b/web/styles/rendered_markdown.css@@ -653,9 +653,12 @@.message_inline_video,.message_inline_animated_image_still,.youtube-video .media-anchor-element {- /* We require a relative positioning context- for the sake of play buttons. */- position: relative;+ /* Once collections of thumbnails are set to render as+ flex items, this can be updated to use `display: grid`+ instead of `display: inline-grid`. */+ display: inline-grid;+ grid-template: "media" minmax(0, auto) / minmax(0, auto);+ place-items: center center;&:hover {&::after {@@ -663,26 +666,26 @@}}+ /* The .media-anchor-selector is for all media+ except YouTube, which needs to place+ .media-image-element on the grid. */+ & .media-anchor-element,+ & .media-image-element {+ grid-area: media;+ }+&::after {+ grid-area: media;content: "";background-image: url("../images/play_button.svg");background-position: center center;background-repeat: no-repeat;/* 32px at 14px/1em */background-size: 2.2857em;- position: absolute;- /* Match the width to the background size. */+ /* Match the box to the play button's+ background-size value. */width: 2.2857em;height: 2.2857em;- /* Center according to those widths; media- thumbnails are 8em tall and 12em wide. So,- 2.2857em / 2 = 1.1429em as the center of the- play button. We subtract that value from half- the height (8em/2) to get the `top:` value,- and then subtract the same from half the width- (12em/2) to get the `left:` value. */- top: 2.8571em;- left: 4.8571em;border-radius: 100%;transform: scale(0.8);transition: transform 0.2s;@@ -700,6 +703,13 @@}}+ .youtube-video .media-anchor-element {+ /* We display the youtube-video anchor+ as a grid, not inline grid, to avoid+ additional space beneath the thumbnail. */+ display: grid;+ }+.message_embed {display: block;position: relative;