Files
kupshop/web/common/twig/scss/base/_photoswipe.scss
2025-08-02 16:30:27 +02:00

521 lines
9.5 KiB
SCSS

$pswp-bg: $white !default;
$pswp-placeholder-bg: $pswp-bg !default;
$pswp-root-z-index: 100000 !default;
$pswp-preloader-color: rgba(79, 79, 79, 0.4) !default;
$pswp-preloader-color-secondary: rgba(255, 255, 255, 0.9) !default;
// defined via js:
$pswp-transition-duration: $transition-speed !default;
$pswp-icon-color: $text-dark !default;
$pswp-icon-color-secondary: #4f4f4f !default;
$pswp-icon-stroke-color: #4f4f4f !default;
$pswp-icon-stroke-width: 2px !default;
$pswp-close-icon-size: 18px !default;
$pswp-arrows-bg: transparent !default;
$pswp-arrows-bg-hover: $body-bg-alt !default;
$pswp-thumb-border-width: $border-width !default;
$pswp-thumb-border-color: $border-color !default;
$pswp-thumb-border-radius: $border-radius-base !default;
$pswp-thumb-border-color-active: $brand-primary !default;
$pswp-error-text-color: $state-error !default;
/*! PhotoSwipe main CSS by Dmytro Semenov | photoswipe.com */
/*
Styles for basic PhotoSwipe (pswp) functionality (sliding area, open/close transitions)
*/
.pswp {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: $pswp-root-z-index;
display: none;
touch-action: none;
outline: 0;
opacity: 0.003;
contain: layout style size;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
&:focus {
outline: 0;
}
&--open {
display: block;
}
}
/* Prevents focus outline on the root element,
(it may be focused initially) */
.pswp,
.pswp__bg {
transform: translateZ(0);
will-change: opacity;
}
.pswp__bg {
opacity: 0.005;
background: $pswp-bg;
}
.pswp,
.pswp__scroll-wrap {
overflow: hidden;
}
.pswp__scroll-wrap,
.pswp__bg,
.pswp__container,
.pswp__item,
.pswp__content,
.pswp__zoom-wrap {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.pswp__zoom-wrap {
width: auto;
height: auto;
pointer-events: all;
touch-action: auto;
}
.pswp--click-to-zoom.pswp--zoom-allowed .pswp__img {
cursor: -webkit-zoom-in;
cursor: -moz-zoom-in;
cursor: zoom-in;
}
.pswp--click-to-zoom.pswp--zoomed-in .pswp__img {
cursor: move;
cursor: -webkit-grab;
cursor: -moz-grab;
cursor: grab;
}
.pswp--click-to-zoom.pswp--zoomed-in .pswp__img:active {
cursor: -webkit-grabbing;
cursor: -moz-grabbing;
cursor: grabbing;
}
/* :active to override grabbing cursor */
.pswp--no-mouse-drag.pswp--zoomed-in .pswp__img,
.pswp--no-mouse-drag.pswp--zoomed-in .pswp__img:active,
.pswp__img {
cursor: -webkit-zoom-out;
cursor: -moz-zoom-out;
cursor: zoom-out;
}
/* Prevent selection and tap highlights */
.pswp__container,
.pswp__img,
.pswp__button,
.pswp__counter {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.pswp__counter {
display: none;
}
.pswp__item {
/* z-index for fade transition */
z-index: 1;
overflow: hidden;
pointer-events: none;
}
.pswp__hidden {
display: none !important;
}
/* Allow to click through pswp__content element, but not its children */
.pswp__content {
pointer-events: none;
}
.pswp__content > * {
pointer-events: auto;
}
/*
PhotoSwipe UI
*/
/*
Error message appears when image is not loaded
(JS option errorMsg controls markup)
*/
.pswp__error-msg-container {
display: grid;
}
.pswp__error-msg {
margin: auto;
font-size: 1em;
line-height: 1;
color: $pswp-error-text-color;
}
/*
class pswp__hide-on-close is applied to elements that
should hide (for example fade out) when PhotoSwipe is closed
and show (for example fade in) when PhotoSwipe is opened
*/
.pswp .pswp__hide-on-close {
opacity: 0.005;
will-change: opacity;
// transition: opacity $pswp-transition-duration cubic-bezier(0.4, 0, 0.22, 1);
z-index: 10; /* always overlap slide content */
pointer-events: none; /* hidden elements should not be clickable */
}
/* class pswp--ui-visible is added when opening or closing transition starts */
.pswp--ui-visible .pswp__hide-on-close {
opacity: 1;
pointer-events: auto;
}
/* <button> styles, including css reset */
.pswp__button {
position: relative;
display: block;
width: 50px;
height: 60px;
padding: 0;
margin: 0;
overflow: hidden;
cursor: pointer;
background: none;
border: 0;
box-shadow: none;
opacity: 0.85;
-webkit-appearance: none;
-webkit-touch-callout: none;
}
.pswp__button:disabled {
opacity: 0.3;
cursor: auto;
}
.pswp__icn {
fill: $pswp-icon-color;
color: $pswp-icon-color-secondary;
}
.pswp__icn {
position: absolute;
top: 14px;
left: 9px;
width: 32px;
height: 32px;
overflow: hidden;
pointer-events: none;
}
.pswp__icn-shadow {
stroke: var(--pswp-icon-stroke-color);
stroke-width: var(--pswp-icon-stroke-width);
fill: none;
}
.pswp__icn:focus {
outline: 0;
}
/*
div element that matches size of large image,
large image loads on top of it,
used when msrc is not provided
*/
div.pswp__img--placeholder,
.pswp__img--with-bg {
background: $pswp-placeholder-bg;
}
.pswp__img--placeholder {
-webkit-backface-visibility: hidden;
display: none;
}
.pswp__top-bar {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 60px;
display: flex;
flex-direction: row;
justify-content: flex-end;
z-index: 10;
/* allow events to pass through top bar itself */
pointer-events: none !important;
}
.pswp__top-bar > * {
pointer-events: auto;
/* this makes transition significantly more smooth,
even though inner elements are not animated */
will-change: opacity;
}
/* Close button */
.pswp__button--close {
display: flex;
align-items: center;
justify-content: center;
width: 60px;
color: $pswp-icon-color;
font-size: $pswp-close-icon-size;
transition: color $transition-speed;
svg {
width: 1em;
height: 1em;
fill: currentColor;
}
@include haf {
color: $pswp-error-text-color;
}
}
/* Arrow buttons */
.pswp__button--arrow {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
width: 64px;
height: 64px;
top: 50%;
transform: translateY(-50%);
border-radius: 50%;
font-size: 30px;
color: $pswp-icon-color;
background-color: $pswp-arrows-bg;
transition: background-color $transition-speed;
svg {
width: 1em;
height: 1em;
fill: currentColor;
}
&:disabled {
display: none;
cursor: default;
}
&--prev {
left: 110px;
}
&--next {
right: 10px;
}
@include haf {
background-color: $pswp-arrows-bg-hover;
}
}
.pswp--one-slide .pswp__button--arrow {
display: none;
}
/* show arrows only after mouse was used */
.pswp--has_mouse .pswp__button--arrow {
visibility: visible;
}
.pswp__button--arrow--next .pswp__icn {
left: auto;
right: 14px;
/* flip horizontally */
transform: scale(-1, 1);
}
/* Zoom button */
.pswp__button--zoom {
display: none;
}
/*.pswp--zoom-allowed .pswp__button--zoom {
display: block;
}*/
/* "+" => "-" */
.pswp--zoomed-in .pswp__zoom-icn-bar-v {
display: none;
}
/* Loading indicator */
.pswp__preloader {
position: relative;
overflow: hidden;
width: 50px;
height: 60px;
margin-right: auto;
}
.pswp__preloader .pswp__icn {
opacity: 0;
transition: opacity 0.2s linear;
animation: pswp-clockwise 600ms linear infinite;
}
.pswp__preloader--active .pswp__icn {
opacity: 0.85;
}
@keyframes pswp-clockwise {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.pswp__video-container {
position: relative;
//padding-bottom: 56.25%; /* 16:9 */
height: 0;
overflow: hidden;
iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
}
}
// todo thumbs nav
.pswp__thumbs-indicator {
@include custom-scrollbar;
position: absolute;
top: 15px;
bottom: 15px;
overflow-y: auto;
left: 20px;
display: flex;
flex-direction: column;
gap: 10px;
width: 84px;
.pswp__thumb {
display: flex;
align-items: center;
justify-content: center;
width: 78px;
min-height: 78px;
aspect-ratio: 1;
border: $pswp-thumb-border-width solid $pswp-thumb-border-color;
border-radius: $pswp-thumb-border-radius;
background: $pswp-bg;
overflow: hidden;
cursor: pointer;
transition: border-color $transition-speed;
img {
object-fit: contain;
width: 100%;
height: 100%;
}
&--active,
&:hover {
border-color: $pswp-thumb-border-color-active;
}
}
}
@media screen and (max-width: 1199px) {
.pswp__button--arrow--prev {
left: 10px;
}
.pswp__thumbs-indicator {
display: none;
}
}
@media screen and (max-width: $md - 1) {
.pswp__top-bar {
position: static;
}
.pswp__counter {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 64px;
background: $pswp-bg;
box-shadow: $box-shadow-invert;
}
.pswp__button--arrow {
top: unset;
bottom: 0;
transform: none;
font-size: 24px;
&--prev {
left: 0;
}
&--next {
right: 0;
}
@include haf {
background-color: $pswp-arrows-bg;
}
}
}
@media screen and (max-width: $sm - 1) {
.pswp__counter,
.pswp__button--arrow {
height: 50px;
}
.pswp__button--arrow {
font-size: 20px;
width: 50px;
}
}