signal-desktop/stylesheets/components/Lightbox.scss
2023-03-07 09:32:00 -08:00

383 lines
6.6 KiB
SCSS

// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
.Lightbox {
&__container {
background-color: $color-black;
bottom: 0;
left: 0;
position: absolute;
right: 0;
top: var(--titlebar-height);
z-index: $z-index-popup;
}
&__animated {
bottom: 0;
left: 0;
position: absolute;
right: 0;
top: 0;
display: flex;
flex-direction: column;
}
&__main-container {
display: flex;
flex-direction: column;
flex-grow: 1;
// To ensure that a large image doesn't overflow the flex layout
min-height: 50px;
outline: none;
}
&__buttons {
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
min-height: 56px;
}
&__thumbnails {
align-items: center;
display: flex;
justify-content: center;
left: 50%;
position: absolute;
&--container {
height: 44px;
position: relative;
}
}
&__thumbnails_placeholder {
height: 44px;
}
&__thumbnail {
@include button-reset;
position: relative;
border-radius: 6px;
height: 44px;
margin-right: 8px;
overflow: hidden;
width: 44px;
img {
height: 100%;
object-fit: contain;
width: 100%;
opacity: 0.8;
}
&--selected::after {
position: absolute;
top: 0;
left: 0;
content: '';
width: 100%;
height: 100%;
border-radius: 6px;
box-shadow: inset 0px 0px 0px 2px $color-white;
}
&--unavailable {
@include color-svg('../images/image.svg', $color-gray-25);
height: 100%;
width: 100%;
}
}
&__object {
&--container {
display: inline-flex;
flex-grow: 1;
justify-content: center;
overflow: hidden;
position: relative;
// Using this so that the zoom cleanly goes over the footer
z-index: $z-index-base;
&--zoom {
backface-visibility: hidden;
}
}
&--video {
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
}
height: auto;
max-height: 100%;
max-width: 100%;
object-fit: contain;
outline: none;
width: auto;
}
&__unsupported {
@include button-reset;
flex-grow: 1;
height: 100%;
max-width: 200px;
width: 100%;
&--image {
@include color-svg('../images/image.svg', $color-gray-25);
}
&--video {
@include color-svg('../images/movie.svg', $color-gray-25);
}
&--file {
@include color-svg('../images/file.svg', $color-gray-25);
}
&--missing {
@include color-svg(
'../images/full-screen-flow/alert-outline.svg',
$color-gray-25
);
}
}
&__zoomable-container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin: 0 40px;
}
&__zoom-button {
@include button-reset;
max-height: 100%;
max-width: 100%;
cursor: zoom-in;
}
&__object--container--zoom,
&__object--container--fill {
.Lightbox__zoom-button {
cursor: zoom-out;
}
}
&__caption {
@include font-body-2;
color: $color-white;
margin: 12px 0;
text-align: center;
}
&__countdown {
padding: 8px;
}
&__timestamp {
@include font-body-1;
background-color: $color-black;
border-radius: 15px;
color: #eeefef;
padding: 6px 18px;
text-align: center;
}
&__nav-next,
&__nav-prev {
position: absolute;
top: 0;
width: 25%;
height: 100%;
// We need this so that the buttons stack above the container
z-index: $z-index-above-base;
}
&__nav-next {
right: 0;
padding-right: 16px;
}
&__nav-prev {
left: 0;
padding-left: 16px;
}
&__header {
align-items: center;
display: flex;
height: 52px;
justify-content: space-between;
margin-top: var(--title-bar-drag-area-height);
margin-bottom: 16px;
min-height: 52px;
opacity: 1;
padding: 0 16px;
transition: opacity 150ms cubic-bezier(0.17, 0.17, 0, 1);
&--container {
display: flex;
}
&--avatar {
margin-right: 10px;
}
&--name {
@include font-body-2-bold;
color: $color-white;
}
&--timestamp {
@include font-caption;
color: $color-gray-25;
}
}
&__footer {
opacity: 1;
padding: 16px 16px 24px 16px;
transition: opacity 150ms cubic-bezier(0.17, 0.17, 0, 1);
}
&__container--zoom {
.Lightbox__header,
.Lightbox__footer {
opacity: 0;
}
}
&__container--has-controls {
.Lightbox__nav-next,
.Lightbox__nav-prev {
// Give some room for <video/>'s controls.
$controls-height: 64px;
padding-top: $controls-height;
height: calc(100% - $controls-height);
}
}
&__controls {
display: flex;
gap: 32px;
}
&__button {
@include button-reset;
border-radius: 4px;
display: inline-block;
height: 24px;
width: 24px;
&::before {
content: '';
display: block;
height: 100%;
width: 100%;
}
&:hover {
&::before {
background: $color-white;
}
}
&:focus {
outline: 4px solid $color-ultramarine;
}
&:disabled {
&::before {
background: $color-gray-65;
}
}
&--forward {
&::before {
@include color-svg(
'../images/icons/v2/forward-outline-24.svg',
$color-gray-15
);
}
}
&--save {
&::before {
@include color-svg(
'../images/icons/v2/download-outline-24.svg',
$color-gray-15
);
}
}
&--close {
&::before {
@include color-svg('../images/icons/v2/x-24.svg', $color-gray-15);
}
}
&--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;
}
&:hover {
opacity: 1;
}
outline: none;
&:focus {
outline: none;
}
@include keyboard-mode {
&:focus {
opacity: 1;
}
}
@include button-focus-outline;
}
&--previous {
justify-content: start;
&::before {
@include color-svg(
'../images/icons/v2/arrow-left-32.svg',
$color-gray-05
);
}
}
&--next {
justify-content: end;
&::before {
@include color-svg(
'../images/icons/v2/arrow-right-32.svg',
$color-gray-05
);
}
}
}
}