Skip to content

Commit

Permalink
turning media assets carousel back on, still WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
pjudge committed Apr 29, 2024
1 parent 8cff5e0 commit 2cb83fe
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
30 changes: 27 additions & 3 deletions themes/mukurtu_v4/js/media-asset-carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,42 @@
*/

((Drupal, once) => {
let main, thumbnails;
/**
* Initialize the carousel.
*/
function init(el) {
splide.refresh();
// main.sync( thumbnails );
// main.mount();
// thumbnails.mount();
}

Drupal.behaviors.mediaAssetCarousel = {
attach(context) {
once("mediaAssets", ".field--name-field-media-assets", context).forEach(init);

if (Drupal.behaviors.mediaAssetCarousel.mediaAssetSlider == undefined) {
// main = new Splide( '#main-carousel', {
// type : 'fade',
// rewind : true,
// pagination: false,
// arrows : false,
// } );

// thumbnails = new Splide( '.splide.media-carousel', {
// fixedWidth : 100,
// fixedHeight : 60,
// gap : 10,
// rewind : true,
// pagination : false,
// isNavigation: true,
// breakpoints : {
// 600: {
// fixedWidth : 60,
// fixedHeight: 44,
// },
// },
// } );


Drupal.behaviors.mediaAssetCarousel.mediaAssetSlider = new Splide('.splide.media-carousel', {
perPage: 3,
Expand All @@ -28,7 +52,7 @@
gap: '16px',
start: 0,
}).mount();
}

}
};
})(Drupal, once);
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@

<div class="full-node__main">
<div class="full-node__content">
{# <h1>HERE BE THE TEST</h1>
{{ node.field_media_assets|view('carousel_thumbnail') }} #}
{{ content.group_primary_fields|without('field_all_related_content') }}
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@
]
%}

{{ attach_library('mukurtu_v4/splide') }}
{{ attach_library('mukurtu_v4/media-carousel') }}
{{ attach_library('mukurtu_v4/splide') }}
{{ attach_library('mukurtu_v4/media-carousel') }}

{% if items|length > 1 %}

{# a carousel needs to appear #}
{# The large size media carousel. #}
<section{{ attributes.addClass(classes, 'field__items splide media-carousel') }} aria-label="Media Assets Carousel">
<div class="splide__track">
<ul class="splide__list">
Expand All @@ -69,6 +69,8 @@
</div>
</section>

{# The thumbnail carousel. #}

{% else %}

<div{{ attributes }}>
Expand Down

0 comments on commit 2cb83fe

Please sign in to comment.