Propper style for attachments carousel.

This commit is contained in:
mateuswetah 2020-09-30 10:06:00 -03:00
parent cbdc6683df
commit 02f6a36954
8 changed files with 88 additions and 39 deletions

View File

@ -190,6 +190,7 @@ function blocksy_tainacan_swiper_scripts() {
$post_type = get_post_type(); $post_type = get_post_type();
if ( in_array($post_type, $collections_post_types) ) { if ( in_array($post_type, $collections_post_types) ) {
wp_enqueue_style( 'swiper', 'https://unpkg.com/swiper/swiper-bundle.min.css', array(), BLOCKSY_TAINACAN_VERSION );
wp_enqueue_script( 'swiper', 'https://unpkg.com/swiper/swiper-bundle.min.js', array(), BLOCKSY_TAINACAN_VERSION, true ); wp_enqueue_script( 'swiper', 'https://unpkg.com/swiper/swiper-bundle.min.js', array(), BLOCKSY_TAINACAN_VERSION, true );
wp_enqueue_script( 'blocksy-tainacan-scripts', get_stylesheet_directory_uri() . '/js/attachments-carousel.js', ['swiper'], BLOCKSY_TAINACAN_VERSION, true ); wp_enqueue_script( 'blocksy-tainacan-scripts', get_stylesheet_directory_uri() . '/js/attachments-carousel.js', ['swiper'], BLOCKSY_TAINACAN_VERSION, true );
} }

View File

@ -1,10 +1,6 @@
const attachmentsThumbsSwiper = new Swiper('.swiper-container-thumbs', { const attachmentsThumbsSwiper = new Swiper('.swiper-container-thumbs', {
spaceBetween: 10, spaceBetween: 10,
slidesPerView: 6, slidesPerView: 7,
freeMode: true,
watchSlidesVisibility: true,
watchSlidesProgress: true,
watchOverflow: true,
navigation: { navigation: {
nextEl: '.swiper-button-next', nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev', prevEl: '.swiper-button-prev',

View File

@ -132,23 +132,20 @@
.single-item-collection--gallery-items, .single-item-collection--gallery-items,
.single-item-collection--attachments { .single-item-collection--attachments {
.single-item-collection--attachments-file { .single-item-collection--attachments-file {
margin: 10px;
text-align: center; text-align: center;
display: inline-block;
vertical-align: top; vertical-align: top;
cursor: pointer; cursor: pointer;
word-break: break-all; word-break: break-all;
font-size: 0.875em; font-size: 0.875em;
padding: 0 14px; padding: 0 6px;
@media only screen and (max-width: 380px) { @media only screen and (max-width: 380px) {
margin: 10px 0; margin: 10px 0;
} }
img { img {
width: 125px; width: 130px;
height: 125px; height: 130px;
display: inline-block;
object-fit: cover; object-fit: cover;
&:focus { &:focus {
outline: none; outline: none;
@ -156,9 +153,7 @@
} }
a { a {
width: 100%; width: 100%;
max-width: 125px; max-width: 130px;
margin: 0 auto;
display: inline-block;
font-size: 0.875rem; font-size: 0.875rem;
text-align: center; text-align: center;
word-break: break-all; word-break: break-all;
@ -177,9 +172,6 @@
background-color: #dbdbdb; background-color: #dbdbdb;
object-fit: contain; object-fit: contain;
} }
.item-card--thumbnail {
margin: 0 0 4px 0 !important;
}
} }
} }
.s-item-collection--metadata { .s-item-collection--metadata {
@ -266,4 +258,37 @@
border-left: 1px solid #f2f2f2; border-left: 1px solid #f2f2f2;
} }
} }
--swiper-theme-color: var(--paletteColor1, #3eaf7c);
--swiper-navigation-color: var(--paletteColor1, #3eaf7c);
.swiper-container {
.swiper-button-disabled {
display: none;
}
.swiper-button-next,
.swiper-button-prev {
top: calc(130px/2);
&:after {
filter: drop-shadow(0px 0px 1px white);
}
}
.swiper-button-prev {
left: -30px;
transition: left 0.3s ease;
}
.swiper-button-next {
right: -30px;
transition: right 0.3s ease;
}
&:hover {
.swiper-button-prev {
left: 10px;
}
.swiper-button-next {
right: 10px;
}
}
}
} }

View File

@ -300,6 +300,11 @@ body:not(.tainacan-admin-page) .tainacan-modal-content .modal-card-body {
} }
/* Single Item Page */ /* Single Item Page */
.single-item-data-section {
--swiper-theme-color: var(--paletteColor1, #3eaf7c);
--swiper-navigation-color: var(--paletteColor1, #3eaf7c);
}
.single-item-data-section h1 { .single-item-data-section h1 {
--fontSize: 30px; --fontSize: 30px;
} }
@ -443,14 +448,12 @@ body:not(.tainacan-admin-page) .tainacan-modal-content .modal-card-body {
.single-item-data-section .single-item-collection--gallery-items .single-item-collection--attachments-file, .single-item-data-section .single-item-collection--gallery-items .single-item-collection--attachments-file,
.single-item-data-section .single-item-collection--attachments .single-item-collection--attachments-file { .single-item-data-section .single-item-collection--attachments .single-item-collection--attachments-file {
margin: 10px;
text-align: center; text-align: center;
display: inline-block;
vertical-align: top; vertical-align: top;
cursor: pointer; cursor: pointer;
word-break: break-all; word-break: break-all;
font-size: 0.875em; font-size: 0.875em;
padding: 0 14px; padding: 0 6px;
} }
@media only screen and (max-width: 380px) { @media only screen and (max-width: 380px) {
@ -462,9 +465,8 @@ body:not(.tainacan-admin-page) .tainacan-modal-content .modal-card-body {
.single-item-data-section .single-item-collection--gallery-items .single-item-collection--attachments-file img, .single-item-data-section .single-item-collection--gallery-items .single-item-collection--attachments-file img,
.single-item-data-section .single-item-collection--attachments .single-item-collection--attachments-file img { .single-item-data-section .single-item-collection--attachments .single-item-collection--attachments-file img {
width: 125px; width: 130px;
height: 125px; height: 130px;
display: inline-block;
object-fit: cover; object-fit: cover;
} }
@ -476,9 +478,7 @@ body:not(.tainacan-admin-page) .tainacan-modal-content .modal-card-body {
.single-item-data-section .single-item-collection--gallery-items .single-item-collection--attachments-file a, .single-item-data-section .single-item-collection--gallery-items .single-item-collection--attachments-file a,
.single-item-data-section .single-item-collection--attachments .single-item-collection--attachments-file a { .single-item-data-section .single-item-collection--attachments .single-item-collection--attachments-file a {
width: 100%; width: 100%;
max-width: 125px; max-width: 130px;
margin: 0 auto;
display: inline-block;
font-size: 0.875rem; font-size: 0.875rem;
text-align: center; text-align: center;
word-break: break-all; word-break: break-all;
@ -504,11 +504,6 @@ body:not(.tainacan-admin-page) .tainacan-modal-content .modal-card-body {
object-fit: contain; object-fit: contain;
} }
.single-item-data-section .single-item-collection--gallery-items .single-item-collection--attachments-file .item-card--thumbnail,
.single-item-data-section .single-item-collection--attachments .single-item-collection--attachments-file .item-card--thumbnail {
margin: 0 0 4px 0 !important;
}
.single-item-data-section .s-item-collection--metadata { .single-item-data-section .s-item-collection--metadata {
height: 100%; height: 100%;
} }
@ -607,4 +602,36 @@ body:not(.tainacan-admin-page) .tainacan-modal-content .modal-card-body {
border-left: 1px solid #f2f2f2; border-left: 1px solid #f2f2f2;
} }
.single-item-data-section .swiper-container .swiper-button-disabled {
display: none;
}
.single-item-data-section .swiper-container .swiper-button-next,
.single-item-data-section .swiper-container .swiper-button-prev {
top: calc(130px/2);
}
.single-item-data-section .swiper-container .swiper-button-next:after,
.single-item-data-section .swiper-container .swiper-button-prev:after {
filter: drop-shadow(0px 0px 1px white);
}
.single-item-data-section .swiper-container .swiper-button-prev {
left: -30px;
transition: left 0.3s ease;
}
.single-item-data-section .swiper-container .swiper-button-next {
right: -30px;
transition: right 0.3s ease;
}
.single-item-data-section .swiper-container:hover .swiper-button-prev {
left: 10px;
}
.single-item-data-section .swiper-container:hover .swiper-button-next {
right: 10px;
}
/*# sourceMappingURL=style.css.map */ /*# sourceMappingURL=style.css.map */

File diff suppressed because one or more lines are too long

2
style.min.css vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -85,7 +85,7 @@
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php else : ?> <?php else : ?>
<div class="single-item-collection--attachments swiper-container-thumbs"> <div class="single-item-collection--attachments swiper-container-thumbs swiper-container">
<div class="swiper-wrapper"> <div class="swiper-wrapper">
<?php foreach ( $attachments as $attachment ) { ?> <?php foreach ( $attachments as $attachment ) { ?>
<?php <?php
@ -109,10 +109,10 @@
</a> </a>
</div> </div>
<?php } ?> <?php } ?>
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
</div> </div>
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
</div> </div>
<?php endif; ?> <?php endif; ?>
</section> </section>