| 1 |
@use "sass:math"; |
| 2 |
|
| 3 |
/** |
| 4 |
* Frontend Styles |
| 5 |
*/ |
| 6 |
@import "./variables"; |
| 7 |
@import "./icon-only"; |
| 8 |
|
| 9 |
@mixin setPaddingAspectRatio($width, $height) { |
| 10 |
&[data-video-aspect-ratio="#{$width}-#{$height}"]="#{$width}-#{$height}""]::before, |
| 11 |
&[data-video-aspect-ratio="#{$width}:#{$height}"]="#{$width}:#{$height}""]::before, |
| 12 |
&-aspect-ratio-#{$width}-#{$height}::before { |
| 13 |
padding-top: #{math.div($height, $width) * 100%}; |
| 14 |
} |
| 15 |
} |
| 16 |
|
| 17 |
.ghostkit-video { |
| 18 |
position: relative; |
| 19 |
overflow: hidden; |
| 20 |
cursor: pointer; |
| 21 |
background-color: var(--gkt-video__background-color); |
| 22 |
|
| 23 |
// Aspect Ratio. |
| 24 |
&::before { |
| 25 |
display: block; |
| 26 |
width: 100%; |
| 27 |
padding-top: 56.25%; |
| 28 |
content: ""; |
| 29 |
} |
| 30 |
|
| 31 |
@each $width, $height in (16:9, 21:9, 4:3, 3:2, 1:1, 2:3, 9:16) { |
| 32 |
@include setPaddingAspectRatio($width, $height); |
| 33 |
} |
| 34 |
|
| 35 |
@include setPaddingAspectRatio(3, 4); |
| 36 |
|
| 37 |
// poster |
| 38 |
&-poster { |
| 39 |
position: absolute; |
| 40 |
top: 0; |
| 41 |
left: 0; |
| 42 |
z-index: 1; |
| 43 |
width: 100%; |
| 44 |
height: 100%; |
| 45 |
|
| 46 |
img { |
| 47 |
width: 100%; |
| 48 |
height: 100%; |
| 49 |
object-fit: cover; |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
// play icon |
| 54 |
&-play-icon { |
| 55 |
position: absolute; |
| 56 |
top: 50%; |
| 57 |
left: 50%; |
| 58 |
z-index: 2; |
| 59 |
display: flex; |
| 60 |
align-items: center; |
| 61 |
justify-content: center; |
| 62 |
width: var(--gkt-video--play-icon__width); |
| 63 |
height: var(--gkt-video--play-icon__height); |
| 64 |
margin-top: calc(var(--gkt-video--play-icon__width) / -2); |
| 65 |
margin-left: calc(var(--gkt-video--play-icon__height) / -2); |
| 66 |
font-size: var(--gkt-video--play-icon__font-size); |
| 67 |
color: var(--gkt-video--play-icon__color); |
| 68 |
background-color: var(--gkt-video--play-icon__background-color); |
| 69 |
border-radius: var(--gkt-video--play-icon__border-radius); |
| 70 |
box-shadow: var(--gkt-video--play-icon__box-shadow); |
| 71 |
opacity: 1; |
| 72 |
transition: var(--gkt-video__transition-duration) transform var(--gkt-video__transition-easing), var(--gkt-video__transition-duration) box-shadow var(--gkt-video__transition-easing), var(--gkt-video__transition-duration) opacity var(--gkt-video__transition-easing); |
| 73 |
} |
| 74 |
|
| 75 |
&:hover &-play-icon, |
| 76 |
&:focus &-play-icon { |
| 77 |
box-shadow: var(--gkt-video--play-icon-hover__box-shadow); |
| 78 |
transform: var(--gkt-video--play-icon-hover__transform); |
| 79 |
} |
| 80 |
|
| 81 |
&-loading &-play-icon, |
| 82 |
&-playing &-play-icon { |
| 83 |
opacity: 0; |
| 84 |
} |
| 85 |
|
| 86 |
// loading icon |
| 87 |
&-loading-icon { |
| 88 |
position: absolute; |
| 89 |
top: 50%; |
| 90 |
left: 50%; |
| 91 |
z-index: 3; |
| 92 |
display: flex; |
| 93 |
align-items: center; |
| 94 |
justify-content: center; |
| 95 |
width: var(--gkt-video--loading-icon__width); |
| 96 |
height: var(--gkt-video--loading-icon__height); |
| 97 |
margin-top: calc(var(--gkt-video--loading-icon__width) / -2); |
| 98 |
margin-left: calc(var(--gkt-video--loading-icon__height) / -2); |
| 99 |
font-size: var(--gkt-video--loading-icon__font-size); |
| 100 |
color: var(--gkt-video--loading-icon__color); |
| 101 |
background-color: var(--gkt-video--loading-icon__background-color); |
| 102 |
border-radius: var(--gkt-video--loading-icon__border-radius); |
| 103 |
box-shadow: var(--gkt-video--loading-icon__box-shadow); |
| 104 |
opacity: 0; |
| 105 |
transition: var(--gkt-video__transition-duration) opacity var(--gkt-video__transition-easing); |
| 106 |
} |
| 107 |
|
| 108 |
&-loading &-loading-icon { |
| 109 |
opacity: 1; |
| 110 |
} |
| 111 |
// prevent animation when hidden. |
| 112 |
&:not(&-loading) &-spinner { |
| 113 |
animation: none; |
| 114 |
} |
| 115 |
|
| 116 |
// Fullscreen close icon |
| 117 |
&-fullscreen-close-icon { |
| 118 |
display: none; |
| 119 |
} |
| 120 |
|
| 121 |
// video frame |
| 122 |
&-frame { |
| 123 |
position: absolute; |
| 124 |
top: 0; |
| 125 |
left: 100%; |
| 126 |
z-index: 4; |
| 127 |
width: 100%; |
| 128 |
height: 100%; |
| 129 |
opacity: 0; |
| 130 |
transition: var(--gkt-video__transition-duration) opacity var(--gkt-video__transition-easing), 0s var(--gkt-video__transition-duration) left; |
| 131 |
|
| 132 |
iframe, |
| 133 |
video { |
| 134 |
width: 100%; |
| 135 |
height: 100%; |
| 136 |
|
| 137 |
// fix for some themes. |
| 138 |
visibility: visible; |
| 139 |
} |
| 140 |
} |
| 141 |
|
| 142 |
&-playing &-frame { |
| 143 |
left: 0; |
| 144 |
opacity: 1; |
| 145 |
transition: var(--gkt-video__transition-duration) opacity var(--gkt-video__transition-easing), 0s left; |
| 146 |
} |
| 147 |
|
| 148 |
// Fullscreen video |
| 149 |
&-fullscreen { |
| 150 |
position: fixed; |
| 151 |
top: var(--wp-admin--admin-bar--height, 0); |
| 152 |
left: 0; |
| 153 |
z-index: 1500; |
| 154 |
display: none; |
| 155 |
align-items: center; |
| 156 |
justify-content: center; |
| 157 |
width: 100%; |
| 158 |
height: calc(100% - var(--wp-admin--admin-bar--height, 0px)); |
| 159 |
background-color: var(--gkt-video-fullscreen__background-color); |
| 160 |
|
| 161 |
// fixed top position when WP admin bar showed. |
| 162 |
@media screen and (max-width: 600px) { |
| 163 |
body.admin-bar & { |
| 164 |
top: 0; |
| 165 |
height: 100%; |
| 166 |
} |
| 167 |
} |
| 168 |
|
| 169 |
&-frame { |
| 170 |
position: relative; |
| 171 |
z-index: 1; |
| 172 |
width: 90%; |
| 173 |
max-width: calc((90vh - var(--wp-admin--admin-bar--height, 0px)) * var(--gkt-fullscreen-video__aspect-ratio-width) / var(--gkt-fullscreen-video__aspect-ratio-height)); |
| 174 |
height: calc(90vw * var(--gkt-fullscreen-video__aspect-ratio-height) / var(--gkt-fullscreen-video__aspect-ratio-width)); |
| 175 |
max-height: 90%; |
| 176 |
|
| 177 |
// fixed top position when WP admin bar showed. |
| 178 |
@media screen and (max-width: 600px) { |
| 179 |
body.admin-bar & { |
| 180 |
max-width: calc(100vh * var(--gkt-fullscreen-video__aspect-ratio-width) / var(--gkt-fullscreen-video__aspect-ratio-height)); |
| 181 |
} |
| 182 |
} |
| 183 |
|
| 184 |
iframe, |
| 185 |
video { |
| 186 |
width: 100%; |
| 187 |
height: 100%; |
| 188 |
} |
| 189 |
|
| 190 |
video { |
| 191 |
background: var(--gkt-fullscreen-video--video__background); |
| 192 |
} |
| 193 |
} |
| 194 |
|
| 195 |
&-close { |
| 196 |
position: absolute; |
| 197 |
top: 0; |
| 198 |
right: 0; |
| 199 |
z-index: 2; |
| 200 |
width: var(--gkt-video-fullscreen--close-button__width); |
| 201 |
height: var(--gkt-video-fullscreen--close-button__height); |
| 202 |
font-size: var(--gkt-video-fullscreen--close-button__font-size); |
| 203 |
line-height: var(--gkt-video-fullscreen--close-button__height); |
| 204 |
color: var(--gkt-video-fullscreen--close-button__color); |
| 205 |
text-align: center; |
| 206 |
cursor: pointer; |
| 207 |
opacity: var(--gkt-video-fullscreen--close-button__opacity); |
| 208 |
transition: var(--gkt-video-fullscreen__transition-duration) opacity var(--gkt-video-fullscreen__transition-easing); |
| 209 |
|
| 210 |
&:hover, |
| 211 |
&:focus { |
| 212 |
opacity: var(--gkt-video-fullscreen--close-button-hover__opacity); |
| 213 |
} |
| 214 |
} |
| 215 |
} |
| 216 |
} |
| 217 |
|