diff --git a/components/00-tokens/effects/yds-animate.js b/components/00-tokens/effects/yds-animate.js index 99395ef97..616ce0fb0 100644 --- a/components/00-tokens/effects/yds-animate.js +++ b/components/00-tokens/effects/yds-animate.js @@ -9,7 +9,7 @@ Drupal.behaviors.animateItems = { // Select all elements with [data-animate-item] attribute const elementsToAnimate = context.querySelectorAll( - '[data-animate-item="true"]', + '[data-animate-item="enabled"]', ); // Check if the user prefers reduced motion @@ -43,7 +43,7 @@ Drupal.behaviors.animateItems = { // Set each component to data-animate-item false if prefers reduced motion. if (!prefersReducedMotionNoPref) { elementsToAnimate.forEach((reducedMotionElement) => { - reducedMotionElement.setAttribute('data-animate-item', 'false'); + reducedMotionElement.setAttribute('data-animate-item', 'disabled'); }); } }, diff --git a/components/01-atoms/divider/_yds-divider.scss b/components/01-atoms/divider/_yds-divider.scss index 0e7391c7f..01937cfe2 100644 --- a/components/01-atoms/divider/_yds-divider.scss +++ b/components/01-atoms/divider/_yds-divider.scss @@ -32,7 +32,7 @@ $divider-positions: left, center; // if animation is active [data-site-animation='artistic'] & { - &[data-animate-item='true'] { + &[data-animate-item='enabled'] { @include tokens.animate( $property: 'transform', $duration: var(--animation-speed-slow) diff --git a/components/01-atoms/divider/yds-divider.twig b/components/01-atoms/divider/yds-divider.twig index e9db221dd..1e12f1ad2 100644 --- a/components/01-atoms/divider/yds-divider.twig +++ b/components/01-atoms/divider/yds-divider.twig @@ -21,11 +21,9 @@ class: bem('inner', [], divider__base_class), } %} -{% if animate__item == true %} - {% set divider__attributes = divider__attributes|merge({ - 'data-animate-item': animate__item, - }) %} -{% endif %} +{% set divider__attributes = divider__attributes|merge({ + 'data-animate-item': animate__item|default('enabled'), +}) %} {% set divider__attributes = divider__attributes|merge({ class: bem(divider__base_class), diff --git a/components/02-molecules/cards/reference-card/_yds-reference-card.scss b/components/02-molecules/cards/reference-card/_yds-reference-card.scss index 604e9e7c2..57c251401 100644 --- a/components/02-molecules/cards/reference-card/_yds-reference-card.scss +++ b/components/02-molecules/cards/reference-card/_yds-reference-card.scss @@ -8,12 +8,6 @@ $break-card-collection-list-image-max: tokens.$break-s - 0.05; @include atoms.clickable-component-heading-link; @include atoms.clickable-component-image; - // only animate if animation is enabled in site configuration. - [data-site-animation='artistic'] & { - @include tokens.animate($property: 'transform'); - @include tokens.rise-effect; - } - --color-text-shadow: var(--color-basic-white); display: flex; @@ -47,6 +41,12 @@ $break-card-collection-list-image-max: tokens.$break-s - 0.05; box-shadow: var(--drop-shadow-level-1-bottom-shadow-only); } } + + // only animate if animation is enabled in site configuration. + [data-site-animation='artistic'] [data-animate-item='enabled'] & { + @include tokens.animate($property: 'transform'); + @include tokens.rise-effect; + } } .reference-card__image { diff --git a/components/02-molecules/pull-quote/_yds-pull-quote.scss b/components/02-molecules/pull-quote/_yds-pull-quote.scss index 55d715418..18d0d8b8d 100644 --- a/components/02-molecules/pull-quote/_yds-pull-quote.scss +++ b/components/02-molecules/pull-quote/_yds-pull-quote.scss @@ -16,7 +16,7 @@ blockquote { // if animation is active [data-site-animation='artistic'] & { - &[data-animate-item='true'] { + &[data-animate-item='enabled'] { @include tokens.animate( $property: 'transform', $duration: var(--animation-speed-slow) diff --git a/components/02-molecules/pull-quote/yds-pull-quote.twig b/components/02-molecules/pull-quote/yds-pull-quote.twig index 98d20e532..8e074884a 100644 --- a/components/02-molecules/pull-quote/yds-pull-quote.twig +++ b/components/02-molecules/pull-quote/yds-pull-quote.twig @@ -13,11 +13,9 @@ {# If pull_quote__attributes is not defined, set it to an empty object by default #} {% set pull_quote__attributes = pull_quote__attributes|default({}) %} -{% if animate__item == true %} - {% set pull_quote__attributes = pull_quote__attributes|merge({ - 'data-animate-item': animate__item, - }) %} -{% endif %} +{% set pull_quote__attributes = pull_quote__attributes|merge({ + 'data-animate-item': animate__item|default('enabled'), +}) %} {% set pull_quote__attributes = pull_quote__attributes|merge({ diff --git a/components/03-organisms/card-collection/yds-card-collection.twig b/components/03-organisms/card-collection/yds-card-collection.twig index a7106eadd..e802cd39a 100644 --- a/components/03-organisms/card-collection/yds-card-collection.twig +++ b/components/03-organisms/card-collection/yds-card-collection.twig @@ -27,6 +27,10 @@ }) %} {% endif %} +{% set card_collection__attributes = card_collection__attributes|merge({ + 'data-animate-item': animate__item|default('enabled'), +}) %} +
Davis and her teammate Lars Plate, assistant professor of chemistry and biological sciences at Vanderbilt University, were two of 21 researchers to receive the award. They will work together on their project, “Structure-Function of Enzyme Filaments: Regulators of Cell Metabolism in Space and Time.”
', } %} {% include "@molecules/pull-quote/yds-pull-quote.twig" with { - animate__item: [true], + animate__item: 'enabled', pull_quote__quote: 'Our platform will transform our ability to study metabolic filaments and, coupled with biochemical and biophysical tools, manipulate enzyme structures and metabolic activity in cells.', } %} {% include "@molecules/text/yds-text-field.twig" with { @@ -61,6 +61,7 @@ card_collection__source_type: 'events', card_collection__type: 'grid', card_collection__width: 'content', + animate__item: 'enabled', card_collection__cards:[ { reference_card__date: '2022-03-30 13:00', diff --git a/components/05-page-examples/post/post-grid.twig b/components/05-page-examples/post/post-grid.twig index 9d18a9e96..1335c60ad 100644 --- a/components/05-page-examples/post/post-grid.twig +++ b/components/05-page-examples/post/post-grid.twig @@ -1,62 +1,64 @@ -