signal-desktop/stylesheets/components/Lightbox.scss

403 lines
7.5 KiB
SCSS
Raw Normal View History

2021-08-23 23:14:53 +00:00
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
2024-11-15 23:09:31 +00:00
@use '../mixins';
@use '../variables';
2021-08-23 23:14:53 +00:00
.Lightbox {
&__container {
2024-11-15 23:09:31 +00:00
background-color: variables.$color-black;
2021-08-23 23:14:53 +00:00
bottom: 0;
2023-04-20 17:03:43 +00:00
inset-inline: 0;
2021-08-23 23:14:53 +00:00
position: absolute;
top: 0;
2024-11-15 23:09:31 +00:00
z-index: variables.$z-index-popup;
}
&__animated {
bottom: 0;
2023-04-20 17:03:43 +00:00
inset-inline: 0;
position: absolute;
top: 0;
display: flex;
flex-direction: column;
2021-08-23 23:14:53 +00:00
}
&__main-container {
display: flex;
flex-direction: column;
flex-grow: 1;
2022-02-09 20:33:19 +00:00
// To ensure that a large image doesn't overflow the flex layout
2021-08-23 23:14:53 +00:00
min-height: 50px;
outline: none;
}
&__buttons {
2021-08-23 23:14:53 +00:00
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
min-height: 56px;
}
&__thumbnails {
align-items: center;
display: flex;
justify-content: center;
2023-04-20 17:03:43 +00:00
inset-inline-start: 50%;
2021-08-23 23:14:53 +00:00
position: absolute;
&--container {
2023-03-03 18:41:42 +00:00
height: 44px;
2021-08-23 23:14:53 +00:00
position: relative;
}
}
&__thumbnail {
2024-11-15 23:09:31 +00:00
@include mixins.button-reset;
& {
position: relative;
border-radius: 6px;
height: 44px;
margin-inline-end: 8px;
overflow: hidden;
width: 44px;
}
2021-08-23 23:14:53 +00:00
img {
height: 100%;
object-fit: contain;
width: 100%;
2023-03-03 18:41:42 +00:00
opacity: 0.8;
2021-08-23 23:14:53 +00:00
}
2023-03-03 18:41:42 +00:00
&--selected::after {
position: absolute;
top: 0;
2023-04-20 17:03:43 +00:00
inset-inline-start: 0;
2023-03-03 18:41:42 +00:00
content: '';
width: 100%;
height: 100%;
border-radius: 6px;
2024-11-15 23:09:31 +00:00
box-shadow: inset 0px 0px 0px 2px variables.$color-white;
2021-08-23 23:14:53 +00:00
}
&--unavailable {
2024-11-15 23:09:31 +00:00
@include mixins.color-svg(
'../images/image.svg',
variables.$color-gray-25
);
& {
height: 100%;
width: 100%;
}
2021-08-23 23:14:53 +00:00
}
}
&__object {
height: auto;
max-height: 100%;
max-width: 100%;
object-fit: contain;
outline: none;
width: auto;
2021-08-23 23:14:53 +00:00
&--container {
display: inline-flex;
flex-grow: 1;
justify-content: center;
overflow: hidden;
position: relative;
2021-12-01 23:13:09 +00:00
// Using this so that the zoom cleanly goes over the footer
2024-11-15 23:09:31 +00:00
z-index: variables.$z-index-base;
&--zoom {
backface-visibility: hidden;
}
2021-08-23 23:14:53 +00:00
}
2022-07-07 21:07:00 +00:00
&--video {
height: 100%;
2023-04-20 17:03:43 +00:00
inset-inline-start: 0;
2022-07-07 21:07:00 +00:00
position: absolute;
top: 0;
width: 100%;
// Prevent nav buttons from overlapping video controls in small viewports
@media (max-height: 500px) {
inset-inline-start: 40px;
width: calc(100% - 80px);
}
2022-07-07 21:07:00 +00:00
}
2021-08-23 23:14:53 +00:00
}
&__unsupported {
2024-11-15 23:09:31 +00:00
@include mixins.button-reset;
& {
flex-grow: 1;
height: 100%;
max-width: 200px;
width: 100%;
}
2021-08-23 23:14:53 +00:00
&--image {
2024-11-15 23:09:31 +00:00
@include mixins.color-svg(
'../images/image.svg',
variables.$color-gray-25
);
2021-08-23 23:14:53 +00:00
}
&--video {
2024-11-15 23:09:31 +00:00
@include mixins.color-svg(
'../images/movie.svg',
variables.$color-gray-25
);
2021-08-23 23:14:53 +00:00
}
&--file {
2024-11-15 23:09:31 +00:00
@include mixins.color-svg('../images/file.svg', variables.$color-gray-25);
2021-08-23 23:14:53 +00:00
}
&--missing {
2024-11-15 23:09:31 +00:00
@include mixins.color-svg(
2021-08-23 23:14:53 +00:00
'../images/full-screen-flow/alert-outline.svg',
2024-11-15 23:09:31 +00:00
variables.$color-gray-25
2021-08-23 23:14:53 +00:00
);
}
}
&__zoomable-container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
2023-04-20 17:03:43 +00:00
margin-block: 0;
margin-inline: 40px;
}
2021-08-23 23:14:53 +00:00
&__zoom-button {
2024-11-15 23:09:31 +00:00
@include mixins.button-reset;
& {
max-height: 100%;
max-width: 100%;
cursor: zoom-in;
}
2021-08-23 23:14:53 +00:00
}
&__object--container--zoom,
&__object--container--fill {
2021-08-23 23:14:53 +00:00
.Lightbox__zoom-button {
cursor: zoom-out;
}
}
&__caption {
2024-11-15 23:09:31 +00:00
@include mixins.font-body-2;
color: variables.$color-white;
2023-04-20 17:03:43 +00:00
margin-block: 12px;
margin-inline: 0;
2021-08-23 23:14:53 +00:00
text-align: center;
}
&__countdown {
padding: 8px;
}
&__timestamp {
2024-11-15 23:09:31 +00:00
@include mixins.font-body-1;
background-color: variables.$color-black;
2021-08-23 23:14:53 +00:00
border-radius: 15px;
color: #eeefef;
2023-04-20 17:03:43 +00:00
padding-block: 6px;
padding-inline: 18px;
2021-08-23 23:14:53 +00:00
text-align: center;
}
2021-12-01 23:13:09 +00:00
&__nav-next,
&__nav-prev {
2023-05-02 13:54:01 +00:00
--height: 224px;
2021-08-23 23:14:53 +00:00
position: absolute;
2023-05-02 13:54:01 +00:00
top: calc(50% - var(--height) / 2);
height: var(--height);
2023-03-03 18:41:42 +00:00
2021-12-01 23:13:09 +00:00
// We need this so that the buttons stack above the container
2024-11-15 23:09:31 +00:00
z-index: variables.$z-index-above-base;
// Added extended click zone only when it wouldn't overlap video controls
@media (min-height: 500px) {
width: 25%;
max-width: 96px;
}
2021-12-01 23:13:09 +00:00
}
&__nav-next {
2023-04-20 17:03:43 +00:00
inset-inline-end: 0;
2023-03-14 16:53:24 +00:00
align-items: end;
2021-08-23 23:14:53 +00:00
}
&__nav-prev {
2023-04-20 17:03:43 +00:00
inset-inline-start: 0;
2023-03-14 16:53:24 +00:00
align-items: start;
2021-08-23 23:14:53 +00:00
}
&__header {
align-items: center;
display: flex;
2023-03-07 17:32:00 +00:00
height: 52px;
2021-08-23 23:14:53 +00:00
justify-content: space-between;
2023-03-07 17:32:00 +00:00
margin-top: var(--title-bar-drag-area-height);
margin-bottom: 16px;
min-height: 52px;
opacity: 1;
2023-04-20 17:03:43 +00:00
padding-block: 0;
padding-inline: 16px;
transition: opacity 150ms cubic-bezier(0.17, 0.17, 0, 1);
2021-08-23 23:14:53 +00:00
&--container {
display: flex;
}
&--avatar {
2023-04-20 17:03:43 +00:00
margin-inline-end: 10px;
2021-08-23 23:14:53 +00:00
}
&--name {
2024-11-15 23:09:31 +00:00
@include mixins.font-body-2-bold;
color: variables.$color-white;
2021-08-23 23:14:53 +00:00
}
&--timestamp {
2024-11-15 23:09:31 +00:00
@include mixins.font-caption;
color: variables.$color-gray-25;
2021-08-23 23:14:53 +00:00
}
}
&__footer {
opacity: 1;
2023-04-20 17:03:43 +00:00
padding-block: 16px 24px;
padding-inline: 16px;
transition: opacity 150ms cubic-bezier(0.17, 0.17, 0, 1);
}
&__container--zoom {
.Lightbox__header,
.Lightbox__footer {
opacity: 0;
}
}
2023-03-03 18:41:42 +00:00
&__controls {
display: flex;
gap: 32px;
}
2021-08-23 23:14:53 +00:00
&__button {
2024-11-15 23:09:31 +00:00
@include mixins.button-reset;
& {
border-radius: 4px;
display: inline-block;
height: 24px;
width: 24px;
}
2021-08-23 23:14:53 +00:00
&::before {
content: '';
display: block;
height: 100%;
width: 100%;
}
&:focus {
2024-11-15 23:09:31 +00:00
outline: 4px solid variables.$color-ultramarine;
2021-08-23 23:14:53 +00:00
}
&:disabled {
&::before {
2024-11-15 23:09:31 +00:00
background: variables.$color-gray-65;
2021-08-23 23:14:53 +00:00
}
}
&--forward {
&::before {
2024-11-15 23:09:31 +00:00
@include mixins.color-svg(
2023-05-04 18:04:22 +00:00
'../images/icons/v3/forward/forward.svg',
2024-11-15 23:09:31 +00:00
variables.$color-gray-15
2021-08-23 23:14:53 +00:00
);
}
}
&--save {
&::before {
2024-11-15 23:09:31 +00:00
@include mixins.color-svg(
'../images/icons/v3/save/save.svg',
variables.$color-gray-15
);
2021-08-23 23:14:53 +00:00
}
}
&--close {
&::before {
2024-11-15 23:09:31 +00:00
@include mixins.color-svg(
'../images/icons/v3/x/x.svg',
variables.$color-gray-15
);
2021-08-23 23:14:53 +00:00
}
}
2023-03-03 18:41:42 +00:00
&--previous,
&--next {
width: 100%;
height: 100%;
opacity: 0;
transition: opacity 200ms ease-in-out;
display: flex;
flex-direction: row;
align-items: center;
&::before {
width: 32px;
height: 32px;
2024-11-15 23:09:31 +00:00
-webkit-filter: drop-shadow(0 0 4px variables.$color-black-alpha-40);
2023-05-23 17:09:48 +00:00
content: '';
display: block;
background-size: 100%;
2023-03-03 18:41:42 +00:00
}
&:hover {
opacity: 1;
}
outline: none;
&:focus {
outline: none;
}
2024-11-15 23:09:31 +00:00
@include mixins.keyboard-mode {
2023-03-03 18:41:42 +00:00
&:focus {
opacity: 1;
}
}
2024-11-15 23:09:31 +00:00
@include mixins.button-focus-outline;
2023-03-03 18:41:42 +00:00
}
2021-08-23 23:14:53 +00:00
&--previous {
2023-03-03 18:41:42 +00:00
justify-content: start;
2023-04-20 17:03:43 +00:00
padding-inline-start: 16px;
2023-03-14 16:53:24 +00:00
2021-08-23 23:14:53 +00:00
&::before {
2023-05-23 17:09:48 +00:00
background-image: url('../images/icons/v3/chevron/chevron-left-white.svg');
2021-08-23 23:14:53 +00:00
}
}
&--next {
2023-03-03 18:41:42 +00:00
justify-content: end;
2023-04-20 17:03:43 +00:00
padding-inline-end: 16px;
2023-03-03 18:41:42 +00:00
2021-08-23 23:14:53 +00:00
&::before {
2023-05-23 17:09:48 +00:00
background-image: url('../images/icons/v3/chevron/chevron-right-white.svg');
2021-08-23 23:14:53 +00:00
}
}
}
}