Skip to content

Commit

Permalink
feat(landing): add change preview background
Browse files Browse the repository at this point in the history
  • Loading branch information
haxgun committed Nov 7, 2023
1 parent 351d05e commit b4528d9
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 5 deletions.
Binary file added public/img/previews/ascent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/previews/bind.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/previews/haven.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/previews/split.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/previews/thumbnails/ascent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/previews/thumbnails/bind.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/previews/thumbnails/haven.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/previews/thumbnails/split.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/previews/thumbnails/sunset.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 33 additions & 1 deletion src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,11 +447,43 @@ document.querySelector('#app').innerHTML = `
</footer>
</div>
</div>
<div class="preview">
<div x-data="
{
currentSlide: 0,
slides: [
'/img/previews/ascent.png',
'/img/previews/bind.png',
'/img/previews/haven.png',
'/img/previews/split.png',
'/img/previews/sunset.png'
],
thumbnails: [
'/img/previews/thumbnails/ascent.png',
'/img/previews/thumbnails/bind.png',
'/img/previews/thumbnails/haven.png',
'/img/previews/thumbnails/split.png',
'/img/previews/thumbnails/sunset.png'
]
}"
class="preview">
<div id="divframe">
<h1 x-show="!search" class="no_iframe">Your preview will be located here. Please enter your profile to see it.</h1>
<div x-transition x-show="search" title="" id="iframe"></div>
</div>
<div class="preview__background">
<template x-for="(slide, index) in slides" :key="index">
<div class="preview__background__image" :style="index === currentSlide ? 'opacity: 1': 'opacity: 0'">
<img :src="slide" alt="Слайд"/>
</div>
</template>
</div>
<div class="preview__thumbnails">
<template x-for="(slide, index) in thumbnails" :key="index">
<div @click="currentSlide = index" class="thumbnail" :class="{ 'active': index === currentSlide }">
<img :src="slide" alt="Миниатюра" />
</div>
</template>
</div>
</div>
<div x-cloak x-show="alert" class="alert" x-transition>
<span>
Expand Down
48 changes: 44 additions & 4 deletions src/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -414,13 +414,9 @@ input.nickname {
}
.preview {
flex: 1;
background-image: url("/img/previews/sunset.png");
background-color: $background-color_6;
width: 100%;
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
overflow: hidden;
&::after {
Expand All @@ -433,6 +429,50 @@ input.nickname {
background: linear-gradient(270deg, rgba(0,0,0,0.5) 0%, $background-color_6 100%);
backdrop-filter: blur(10px);
}

.preview__background {
.preview__background__image {
transition: all 0.2s;
img {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
object-fit: cover;
}
}
}

.preview__thumbnails {
$preview_thumbnails_padding: 25px;
position: absolute;
right: $preview_thumbnails_padding;
bottom: $preview_thumbnails_padding;
z-index: 1;
display: flex;
gap: 16px;

.thumbnail {
cursor: pointer;
border-radius: 50%;
line-height: 0;
transition: all 0.2s;

img {
$thumnail_size: 40px;
width: $thumnail_size;
height: $thumnail_size;
border-radius: 50%;
object-fit: cover;
backdrop-filter: blur(30px);
}

&.active {
box-shadow: 0 0 0 3px $background-color_8;
}
}
}
}
.generate {
display: flex;
Expand Down

0 comments on commit b4528d9

Please sign in to comment.