Skip to content

Commit

Permalink
feat(shs-5693): attached file for prefered reduced motion and add to cal
Browse files Browse the repository at this point in the history
  • Loading branch information
Mari Nez committed Dec 2, 2024
1 parent 68da5c8 commit e1a7c7c
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 1 deletion.
8 changes: 8 additions & 0 deletions docroot/themes/humsci/humsci_basic/humsci_basic.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ accordion:
js:
dist/js/accordion.js: {}

addtocal:
js:
dist/js/addtocal.js: {}

carouselslidesheight:
js:
dist/js/carouselslidesheight.js: {}
Expand Down Expand Up @@ -33,6 +37,10 @@ pagescrollanimations:
js:
dist/js/pagescrollanimations.js: {}

preferedreducedmotion:
js:
dist/js/preferedreducedmotion.js: {}

search:
js:
dist/js/search.js: {}
Expand Down
11 changes: 11 additions & 0 deletions docroot/themes/humsci/humsci_basic/humsci_basic.theme
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ function humsci_basic_preprocess_views_view(&$variables) {
*/
function humsci_basic_preprocess_paragraph(&$variables) {
$paragraph = $variables['paragraph'];
// Attach library to stanford gallery
if ($paragraph->bundle() == 'stanford_gallery') {
$variables['#attached']['library'][] = 'humsci_basic/preferedreducedmotion';
}
if ($paragraph->bundle() != 'hs_view') {
return NULL;
}
Expand Down Expand Up @@ -262,3 +266,10 @@ function humsci_basic_preprocess_field(&$variables) {
$variables['#attached']['library'][] = 'humsci_basic/tablescope';
}
}

/**
* Implements hook_preprocess_ENTITY__BUNDLE().
*/
function humsci_basic_preprocess_node__hs_event(&$variables) {
$variables['#attached']['library'][] = 'humsci_basic/addtocal';
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(function ($, Drupal, window) {
Drupal.behaviors.mySlickBehavior = {
Drupal.behaviors.preferedReducedMotionBehavior = {
attach(context) {
// Check for reduced motion preference
const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{ attach_library('humsci_basic/pagescrollanimations') }}
{{ attach_library('humsci_basic/carouselslidesheight') }}
{{ attach_library('humsci_basic/preferedreducedmotion') }}

{% include '@hs_layouts/gradient-hero/gradient-hero.html.twig' %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{ attach_library('humsci_basic/pagescrollanimations') }}
{{ attach_library('humsci_basic/carouselslidesheight') }}
{{ attach_library('humsci_basic/preferedreducedmotion') }}

{% include '@hs_layouts/hero-text-overlay/hero-text-overlay.html.twig' %}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ attach_library('humsci_basic/carouselslidesheight') }}
{{ attach_library('humsci_basic/preferedreducedmotion') }}

{% include '@hs_layouts/spotlight/spotlight.html.twig' %}

0 comments on commit e1a7c7c

Please sign in to comment.