Make "shadow-lg" class optional in Ping-Pong component of IXM Blocks

Created on 23 October 2024, 24 days ago

Problem/Motivation

Iā€™d like to propose an improvement for the Ping-Pong component in the IXM Blocks module. Currently, the shadow-lg class is hardcoded into the template as shown below:

{% set pp_classes = [ 'ping-pong-item', 'shadow-lg', not loop.first ? 'mt-5', ] %}

In some scenarios, applying this class by default may not suit all needs. To provide greater flexibility, I propose making this class optional. This would allow users to enable or disable it via a configuration option within the Ping-Pong block settings, similar to how the Reversed option is handled.

Here is an example of the Reversed option implementation that could be used as a reference:

{# If the "Reversed" option is checked, add it to our row. #}
{% set reversed = false %}
{% if 'Reversed' in item['#paragraph'].field_ping_pong_options.value %}
  {% set reversed = true %}
{% endif %}

Proposed resolution

  1. Introduce a similar option for the shadow-lg class in the block settings.
  2. Modify the template logic to conditionally apply the class based on whether this option is enabled:
    {# If the "Shadow" option is checked, apply the shadow-lg class. #}
    {% set shadow = false %}
    {% if 'Shadow' in item['#paragraph'].field_ping_pong_options.value %}
      {% set shadow = true %}
    {% endif %}
    
    {%
      set pp_classes = [
        'ping-pong-item',
        shadow ? 'shadow-lg',
        not loop.first ? 'mt-5',
      ]
    %}
    

This solution would offer more control over the visual presentation of the Ping-Pong component without requiring template overrides.

Thank you for your consideration. I believe this improvement would be beneficial for developers who require customizable styling.

āœØ Feature request
Status

Active

Version

1.0

Component

User interface

Created by

šŸ‡§šŸ‡·Brazil pinesso

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024