Files
element-call/src/tile/MediaView.module.css
T

210 lines
4.4 KiB
CSS
Raw Normal View History

2023-01-03 16:58:38 +00:00
/*
Copyright 2022-2024 New Vector Ltd.
2023-01-03 16:58:38 +00:00
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details.
2023-01-03 16:58:38 +00:00
*/
2024-05-02 18:44:36 -04:00
.media {
container-name: mediaView;
container-type: size;
2024-05-02 18:44:36 -04:00
border-radius: var(--media-view-border-radius);
2025-06-26 05:08:57 -04:00
/*Add spacing for the hover boarder. Otherwise it might get clipped.*/
margin: var(--hover-space-margin);
display: grid;
grid-template-areas: "content";
place-items: stretch;
2023-12-01 17:43:09 -05:00
}
2024-05-02 18:44:36 -04:00
.media video {
2023-12-01 17:43:09 -05:00
inline-size: 100%;
block-size: 100%;
object-fit: contain;
background-color: var(--video-tile-background);
2023-12-01 12:37:46 -05:00
/* This transform is a no-op, but it forces Firefox to use a different
rendering path, one that actually clips the corners of <video> elements into
the intended rounded shape. We can remove this if Firefox stops being broken. */
transform: translate(0);
2022-04-07 14:22:36 -07:00
}
2024-05-02 18:44:36 -04:00
.media.mirror video {
2022-04-07 14:22:36 -07:00
transform: scaleX(-1);
}
2024-05-02 18:44:36 -04:00
.media[data-video-fit="cover"] video {
object-fit: cover;
2023-05-12 14:49:55 -04:00
}
2024-05-02 18:44:36 -04:00
.media[data-video-fit="contain"] video {
object-fit: contain;
}
2023-12-01 17:43:09 -05:00
.bg {
grid-area: content;
background-color: var(--video-tile-background);
2023-12-01 17:43:09 -05:00
inline-size: 100%;
block-size: 100%;
border-radius: inherit;
contain: strict;
}
.avatar {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
pointer-events: none;
}
2026-03-16 13:12:49 +01:00
.translucent {
opacity: 50%;
mix-blend-mode: multiply;
}
2023-12-01 17:43:09 -05:00
/* CSS makes us put a condition here, even though all we want to do is
unconditionally select the container so we can use cqmin units */
2024-05-02 18:44:36 -04:00
@container mediaView (width > 0) {
2023-12-01 17:43:09 -05:00
.avatar {
/* Half of the smallest dimension of the tile */
inline-size: 50cqmin;
block-size: 50cqmin;
2023-09-13 16:19:29 -04:00
}
2022-04-07 14:22:36 -07:00
}
2023-12-01 17:43:09 -05:00
.avatar > img {
/* To make avatars scale smoothly with their tiles during animations, we
override the styles set on the element */
inline-size: 100% !important;
block-size: 100% !important;
2022-08-07 19:09:45 +02:00
}
2023-12-01 17:43:09 -05:00
.fg {
grid-area: content;
2026-03-16 13:12:49 +01:00
--fg-inset: var(
2024-05-02 18:44:36 -04:00
--media-view-fg-inset,
calc(var(--media-view-border-radius) - var(--cpd-space-3x))
);
padding: var(--fg-inset);
transition: padding 0.3s;
2023-12-01 17:43:09 -05:00
display: grid;
grid-template-columns: 1fr auto;
2023-12-01 17:43:09 -05:00
grid-template-rows: 1fr auto;
grid-template-areas: "status reactions" "nameTag button";
2023-12-01 17:43:09 -05:00
gap: var(--cpd-space-1x);
place-items: start;
contain: strict;
2022-04-07 14:22:36 -07:00
}
@media (prefers-reduced-motion) {
.fg {
transition: none;
}
}
2023-09-13 16:19:29 -04:00
.nameTag {
2023-12-01 17:43:09 -05:00
grid-area: nameTag;
place-self: end start;
2023-09-13 16:19:29 -04:00
padding: var(--cpd-space-1x);
padding-block: var(--cpd-space-1x);
2023-08-28 16:45:17 -04:00
color: var(--cpd-color-text-primary);
2023-09-27 18:35:38 -04:00
background-color: var(--cpd-color-bg-canvas-default);
2022-04-07 14:22:36 -07:00
display: flex;
align-items: center;
2023-09-13 16:19:29 -04:00
border-radius: var(--cpd-radius-pill-effect);
2022-04-07 14:22:36 -07:00
user-select: none;
overflow: hidden;
2023-09-13 16:19:29 -04:00
box-shadow: var(--small-drop-shadow);
2023-12-01 17:43:09 -05:00
box-sizing: border-box;
max-inline-size: 100%;
2022-04-07 14:22:36 -07:00
}
.status {
grid-area: status;
color: var(--cpd-color-text-primary);
display: flex;
2026-03-16 13:12:49 +01:00
flex-wrap: none;
align-items: center;
2026-03-16 13:12:49 +01:00
gap: 3px;
user-select: none;
overflow: hidden;
2026-03-16 13:12:49 +01:00
margin-block-start: calc(var(--cpd-space-3x) - var(--fg-inset));
margin-inline-start: calc(var(--cpd-space-4x) - var(--fg-inset));
}
.status svg {
color: var(--cpd-color-icon-tertiary);
}
.reactions {
grid-area: reactions;
place-self: start end;
display: flex;
gap: var(--cpd-space-1x);
}
.nameTag > svg,
.nameTag > span {
2023-09-13 16:19:29 -04:00
flex-shrink: 0;
}
.nameTag > .name {
2023-09-13 16:19:29 -04:00
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
padding-inline: var(--cpd-space-2x);
flex-shrink: 1;
2023-08-28 16:45:17 -04:00
}
2023-11-20 19:04:53 -05:00
.errorIcon {
display: block;
2023-11-20 19:04:53 -05:00
color: var(--cpd-color-icon-critical-primary);
}
2023-12-01 17:43:09 -05:00
.fg > button {
appearance: none;
border: none;
border-radius: var(--cpd-radius-pill-effect);
padding: var(--cpd-space-1x);
background: var(--cpd-color-bg-action-primary-rest);
box-shadow: var(--small-drop-shadow);
cursor: pointer;
opacity: 0;
transition:
opacity 0.15s,
background-color 0.1s;
2022-08-02 13:51:05 +02:00
}
2024-05-02 18:44:36 -04:00
.fg:has(:focus-visible) > button,
2023-12-01 17:43:09 -05:00
.fg > button[data-enabled="true"],
.fg > button[data-state="open"] {
opacity: 1;
2022-08-02 16:09:53 +02:00
}
2023-12-01 17:43:09 -05:00
@media (hover) {
.fg:hover > button {
opacity: 1;
}
2022-08-01 19:29:28 +02:00
2023-12-01 17:43:09 -05:00
.fg > button:hover {
background: var(--cpd-color-bg-action-primary-hovered);
}
2022-07-15 11:18:56 +02:00
}
2023-12-01 17:43:09 -05:00
.fg > button:active {
background: var(--cpd-color-bg-action-primary-pressed);
2022-08-01 18:56:59 +02:00
}
2023-12-01 17:43:09 -05:00
.fg > button[data-state="open"] {
background: var(--cpd-color-bg-action-primary-pressed);
2022-04-07 14:22:36 -07:00
}
2023-12-01 17:43:09 -05:00
.fg > button > svg {
display: block;
color: var(--cpd-color-icon-on-solid-primary);
2022-04-07 14:22:36 -07:00
}
2023-12-01 17:43:09 -05:00
.fg > button:first-of-type {
grid-area: button;
place-self: end;
2023-01-30 20:43:21 +01:00
}