diff --git a/modules/edw_paragraphs_parallax_component/README.md b/modules/edw_paragraphs_parallax_component/README.md new file mode 100644 index 0000000..f803189 --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/README.md @@ -0,0 +1,81 @@ +EDW Paragraphs Parallax Component +============================================= + +Provides a Parallax paragraph that displays layered content with GSAP-powered scrolling animations. + +#### Parallax Component +| Field label | Field name | Description | Field type | Cardinality | Required | Translatable | Widget | +|----------------------|------------------------- |--------------------------------------------------------------------|------------------------|-------------|----------|--------------|----------------| +| Title | field_title | Text title displayed in the section | Text (plain) | Single | No | Yes | Text field | +| Text | field_text | Paragraph text content | Text (plain, long) | Single | No | Yes | Text area | +| Image | field_media | Image displayed in the parallax section | Media entity reference | Single | No | No | Media library | +| Animation for Title | field_animation_for_title | Defines GSAP animation type for the title (e.g. slide-up) | List (text) | Single | No | No | Select list | +| Animation for Text | field_animation_for_text | Defines GSAP animation type for the text (e.g. slide-right) | List (text) | Single | No | No | Select list | +| Animation for Image | field_animation_for_image | Defines GSAP animation type for the image (e.g. slide-up) | List (text) | Single | No | No | Select list | +| Vertical Layout | field_vertical_layout | Check to display image and text vertically | Boolean | Single | No | No | Checkbox | +| Reverse Layout | field_reverse_layout | Check to display text first and image after | Boolean | Single | No | No | Checkbox | +| Full-width | field_full_width | Makes the parallax section full-width | Boolean | Single | No | No | Checkbox | +| Background Color | field_background_color | Selects background color variant (e.g. Navy) | List (text) | Single | No | No | Select list | +| Text Color | field_text_color | Selects text color variant (e.g. White) | List (text) | Single | No | No | Select list | + +--- + +GSAP Library Integration + +This module uses GSAP (GreenSock Animation Platform) for parallax and scroll animations. + +Step 1: Add the GSAP package to your composer.json + +Add the following repository entry under "repositories": + +{ + "type": "package", + "package": { + "name": "greensock/gsap", + "version": "3.12.5", + "type": "drupal-library", + "dist": { + "url": "https://github.com/greensock/GSAP/archive/refs/tags/3.12.5.zip", + "type": "zip" + } + } +} + + +Step 2: Install GSAP + +composer require greensock/gsap + + +Step 3: Verify installation + +After installation, GSAP will be available under: +libraries/gsap/ + +Then, update the library definition in: +edw_paragraphs_parallax_component.libraries.yml +to + +parallax_gsap: + css: + theme: + css/parallax-component.css: {} + js: + libraries/gsap/gsap.min.js: {} + + +Usage + +Once enabled, this module provides a Parallax component paragraph type. + +Editors can: + +Add an image, title, and text content. + +Control animation direction for each element (title, text, image). + +Toggle vertical or reverse layout. + +Choose background and text color styles. + +Make the section full-width if needed. diff --git a/modules/edw_paragraphs_parallax_component/config/optional/core.entity_form_display.paragraph.parallax_component.default.yml b/modules/edw_paragraphs_parallax_component/config/optional/core.entity_form_display.paragraph.parallax_component.default.yml new file mode 100644 index 0000000..04f6a86 --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/core.entity_form_display.paragraph.parallax_component.default.yml @@ -0,0 +1,100 @@ +langcode: en +status: true +dependencies: + config: + - field.field.paragraph.parallax_component.field_animation_for_image + - field.field.paragraph.parallax_component.field_animation_for_text + - field.field.paragraph.parallax_component.field_animation_for_title + - field.field.paragraph.parallax_component.field_background_color + - field.field.paragraph.parallax_component.field_full_width + - field.field.paragraph.parallax_component.field_media + - field.field.paragraph.parallax_component.field_reverse_layout + - field.field.paragraph.parallax_component.field_text + - field.field.paragraph.parallax_component.field_text_color + - field.field.paragraph.parallax_component.field_title + - field.field.paragraph.parallax_component.field_vertical_layout + - paragraphs.paragraphs_type.parallax_component + module: + - media_library +id: paragraph.parallax_component.default +targetEntityType: paragraph +bundle: parallax_component +mode: default +content: + field_animation_for_image: + type: options_select + weight: 4 + region: content + settings: { } + third_party_settings: { } + field_animation_for_text: + type: options_select + weight: 5 + region: content + settings: { } + third_party_settings: { } + field_animation_for_title: + type: options_select + weight: 6 + region: content + settings: { } + third_party_settings: { } + field_background_color: + type: options_select + weight: 10 + region: content + settings: { } + third_party_settings: { } + field_full_width: + type: boolean_checkbox + weight: 9 + region: content + settings: + display_label: true + third_party_settings: { } + field_media: + type: media_library_widget + weight: 12 + region: content + settings: + media_types: { } + third_party_settings: { } + field_reverse_layout: + type: boolean_checkbox + weight: 7 + region: content + settings: + display_label: true + third_party_settings: { } + field_text: + type: string_textarea + weight: 1 + region: content + settings: + rows: 5 + placeholder: '' + third_party_settings: { } + field_text_color: + type: options_select + weight: 11 + region: content + settings: { } + third_party_settings: { } + field_title: + type: string_textfield + weight: 0 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: { } + field_vertical_layout: + type: boolean_checkbox + weight: 8 + region: content + settings: + display_label: true + third_party_settings: { } +hidden: + created: true + status: true diff --git a/modules/edw_paragraphs_parallax_component/config/optional/core.entity_view_display.paragraph.parallax_component.default.yml b/modules/edw_paragraphs_parallax_component/config/optional/core.entity_view_display.paragraph.parallax_component.default.yml new file mode 100644 index 0000000..41c3c70 --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/core.entity_view_display.paragraph.parallax_component.default.yml @@ -0,0 +1,114 @@ +langcode: en +status: true +dependencies: + config: + - field.field.paragraph.parallax_component.field_animation_for_image + - field.field.paragraph.parallax_component.field_animation_for_text + - field.field.paragraph.parallax_component.field_animation_for_title + - field.field.paragraph.parallax_component.field_background_color + - field.field.paragraph.parallax_component.field_full_width + - field.field.paragraph.parallax_component.field_media + - field.field.paragraph.parallax_component.field_reverse_layout + - field.field.paragraph.parallax_component.field_text + - field.field.paragraph.parallax_component.field_text_color + - field.field.paragraph.parallax_component.field_title + - field.field.paragraph.parallax_component.field_vertical_layout + - paragraphs.paragraphs_type.parallax_component + module: + - options +id: paragraph.parallax_component.default +targetEntityType: paragraph +bundle: parallax_component +mode: default +content: + field_animation_for_image: + type: list_default + label: above + settings: { } + third_party_settings: { } + weight: 6 + region: content + field_animation_for_text: + type: list_default + label: above + settings: { } + third_party_settings: { } + weight: 5 + region: content + field_animation_for_title: + type: list_default + label: above + settings: { } + third_party_settings: { } + weight: 4 + region: content + field_background_color: + type: list_default + label: above + settings: { } + third_party_settings: { } + weight: 10 + region: content + field_full_width: + type: boolean + label: above + settings: + format: default + format_custom_false: '' + format_custom_true: '' + third_party_settings: { } + weight: 9 + region: content + field_media: + type: entity_reference_entity_view + label: hidden + settings: + view_mode: default + link: false + third_party_settings: { } + weight: 12 + region: content + field_reverse_layout: + type: boolean + label: above + settings: + format: default + format_custom_false: '' + format_custom_true: '' + third_party_settings: { } + weight: 7 + region: content + field_text: + type: basic_string + label: hidden + settings: { } + third_party_settings: { } + weight: 1 + region: content + field_text_color: + type: list_default + label: above + settings: { } + third_party_settings: { } + weight: 11 + region: content + field_title: + type: string + label: hidden + settings: + link_to_entity: false + third_party_settings: { } + weight: 0 + region: content + field_vertical_layout: + type: boolean + label: above + settings: + format: default + format_custom_false: '' + format_custom_true: '' + third_party_settings: { } + weight: 8 + region: content +hidden: + search_api_excerpt: true diff --git a/modules/edw_paragraphs_parallax_component/config/optional/core.entity_view_mode.paragraph.preview.yml b/modules/edw_paragraphs_parallax_component/config/optional/core.entity_view_mode.paragraph.preview.yml new file mode 100644 index 0000000..e88ce8b --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/core.entity_view_mode.paragraph.preview.yml @@ -0,0 +1,12 @@ +langcode: en +status: true +dependencies: + module: + - paragraphs +_core: + default_config_hash: h3BeHVei4Lnyqbkao3YiF4KqoY-DhRvUNfEgKG8Rgjg +id: paragraph.preview +label: Preview +description: '' +targetEntityType: paragraph +cache: true diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_animation_for_image.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_animation_for_image.yml new file mode 100644 index 0000000..f972188 --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_animation_for_image.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.paragraph.field_animation_for_image + - paragraphs.paragraphs_type.parallax_component + module: + - options +id: paragraph.parallax_component.field_animation_for_image +field_name: field_animation_for_image +entity_type: paragraph +bundle: parallax_component +label: 'Animation for Image' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: list_string diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_animation_for_text.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_animation_for_text.yml new file mode 100644 index 0000000..1343569 --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_animation_for_text.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.paragraph.field_animation_for_text + - paragraphs.paragraphs_type.parallax_component + module: + - options +id: paragraph.parallax_component.field_animation_for_text +field_name: field_animation_for_text +entity_type: paragraph +bundle: parallax_component +label: 'Animation for Text' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: list_string diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_animation_for_title.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_animation_for_title.yml new file mode 100644 index 0000000..4f2641e --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_animation_for_title.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.paragraph.field_animation_for_title + - paragraphs.paragraphs_type.parallax_component + module: + - options +id: paragraph.parallax_component.field_animation_for_title +field_name: field_animation_for_title +entity_type: paragraph +bundle: parallax_component +label: 'Animation for Title' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: list_string diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_background_color.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_background_color.yml new file mode 100644 index 0000000..29c58de --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_background_color.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.paragraph.field_background_color + - paragraphs.paragraphs_type.parallax_component + module: + - options +id: paragraph.parallax_component.field_background_color +field_name: field_background_color +entity_type: paragraph +bundle: parallax_component +label: 'Background Color' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: list_string diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_full_width.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_full_width.yml new file mode 100644 index 0000000..a6c38cb --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_full_width.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.paragraph.field_full_width + - paragraphs.paragraphs_type.parallax_component +id: paragraph.parallax_component.field_full_width +field_name: field_full_width +entity_type: paragraph +bundle: parallax_component +label: Full-width +description: 'Check this box to make the section full-width' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + on_label: 'On' + off_label: 'Off' +field_type: boolean diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_media.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_media.yml new file mode 100644 index 0000000..ca831c4 --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_media.yml @@ -0,0 +1,28 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.paragraph.field_media + - media.type.image + - paragraphs.paragraphs_type.parallax_component +id: paragraph.parallax_component.field_media +field_name: field_media +entity_type: paragraph +bundle: parallax_component +label: Image +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + handler: 'default:media' + handler_settings: + target_bundles: + image: image + sort: + field: _none + direction: ASC + auto_create: false + auto_create_bundle: '' +field_type: entity_reference diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_reverse_layout.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_reverse_layout.yml new file mode 100644 index 0000000..229c592 --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_reverse_layout.yml @@ -0,0 +1,21 @@ +uuid: bf41e93c-4603-4e07-8049-a221a21c27d0 +langcode: en +status: true +dependencies: + config: + - field.storage.paragraph.field_reverse_layout + - paragraphs.paragraphs_type.parallax_component +id: paragraph.parallax_component.field_reverse_layout +field_name: field_reverse_layout +entity_type: paragraph +bundle: parallax_component +label: 'Reverse Layout' +description: 'Check this to display the text first and the image after.' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + on_label: 'On' + off_label: 'Off' +field_type: boolean diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_text.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_text.yml new file mode 100644 index 0000000..5efa2f3 --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_text.yml @@ -0,0 +1,18 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.paragraph.field_text + - paragraphs.paragraphs_type.parallax_component +id: paragraph.parallax_component.field_text +field_name: field_text +entity_type: paragraph +bundle: parallax_component +label: Text +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string_long diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_text_color.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_text_color.yml new file mode 100644 index 0000000..a1622f1 --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_text_color.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.paragraph.field_text_color + - paragraphs.paragraphs_type.parallax_component + module: + - options +id: paragraph.parallax_component.field_text_color +field_name: field_text_color +entity_type: paragraph +bundle: parallax_component +label: 'Text Color' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: list_string diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_title.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_title.yml new file mode 100644 index 0000000..140727a --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_title.yml @@ -0,0 +1,18 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.paragraph.field_title + - paragraphs.paragraphs_type.parallax_component +id: paragraph.parallax_component.field_title +field_name: field_title +entity_type: paragraph +bundle: parallax_component +label: Title +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_vertical_layout.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_vertical_layout.yml new file mode 100644 index 0000000..ff9a0df --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.field.paragraph.parallax_component.field_vertical_layout.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.paragraph.field_vertical_layout + - paragraphs.paragraphs_type.parallax_component +id: paragraph.parallax_component.field_vertical_layout +field_name: field_vertical_layout +entity_type: paragraph +bundle: parallax_component +label: 'Vertical Layout' +description: 'Check this to have the image and text vertically.' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + on_label: 'On' + off_label: 'Off' +field_type: boolean diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.storage.node.field_parallax_components.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.node.field_parallax_components.yml new file mode 100644 index 0000000..9c49f01 --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.node.field_parallax_components.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + module: + - entity_reference_revisions + - node + - paragraphs +id: node.field_parallax_components +field_name: field_parallax_components +entity_type: node +type: entity_reference_revisions +settings: + target_type: paragraph +module: entity_reference_revisions +locked: false +cardinality: -1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_animation_for_image.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_animation_for_image.yml new file mode 100644 index 0000000..a43f89a --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_animation_for_image.yml @@ -0,0 +1,35 @@ +langcode: en +status: true +dependencies: + module: + - options + - paragraphs +id: paragraph.field_animation_for_image +field_name: field_animation_for_image +entity_type: paragraph +type: list_string +settings: + allowed_values: + - + value: none + label: none + - + value: slide_up + label: slide-up + - + value: slide_down + label: slide-down + - + value: slide_right + label: slide-right + - + value: slide_left + label: slide-left + allowed_values_function: '' +module: options +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_animation_for_text.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_animation_for_text.yml new file mode 100644 index 0000000..3be96e4 --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_animation_for_text.yml @@ -0,0 +1,35 @@ +langcode: en +status: true +dependencies: + module: + - options + - paragraphs +id: paragraph.field_animation_for_text +field_name: field_animation_for_text +entity_type: paragraph +type: list_string +settings: + allowed_values: + - + value: none + label: none + - + value: slide_up + label: slide-up + - + value: slide_down + label: slide-down + - + value: slide_right + label: slide-right + - + value: slide_left + label: slide-left + allowed_values_function: '' +module: options +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_animation_for_title.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_animation_for_title.yml new file mode 100644 index 0000000..8fad789 --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_animation_for_title.yml @@ -0,0 +1,35 @@ +langcode: en +status: true +dependencies: + module: + - options + - paragraphs +id: paragraph.field_animation_for_title +field_name: field_animation_for_title +entity_type: paragraph +type: list_string +settings: + allowed_values: + - + value: none + label: none + - + value: slide_up + label: slide-up + - + value: slide_down + label: slide-down + - + value: slide_right + label: slide-right + - + value: slide_left + label: slide-left + allowed_values_function: '' +module: options +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_background_color.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_background_color.yml new file mode 100644 index 0000000..67009e6 --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_background_color.yml @@ -0,0 +1,32 @@ +langcode: en +status: true +dependencies: + module: + - options + - paragraphs +id: paragraph.field_background_color +field_name: field_background_color +entity_type: paragraph +type: list_string +settings: + allowed_values: + - + value: navy + label: Navy + - + value: yellow + label: Yellow + - + value: black + label: Black + - + value: gray + label: Gray + allowed_values_function: '' +module: options +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_full_width.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_full_width.yml new file mode 100644 index 0000000..55fbd38 --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_full_width.yml @@ -0,0 +1,17 @@ +langcode: en +status: true +dependencies: + module: + - paragraphs +id: paragraph.field_full_width +field_name: field_full_width +entity_type: paragraph +type: boolean +settings: { } +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_media.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_media.yml new file mode 100644 index 0000000..cb9d0ec --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_media.yml @@ -0,0 +1,19 @@ +langcode: en +status: true +dependencies: + module: + - media + - paragraphs +id: paragraph.field_media +field_name: field_media +entity_type: paragraph +type: entity_reference +settings: + target_type: media +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_reverse_layout.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_reverse_layout.yml new file mode 100644 index 0000000..871761b --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_reverse_layout.yml @@ -0,0 +1,18 @@ +uuid: 43a98a02-cbaf-4730-8f00-6b37b49b2d9b +langcode: en +status: true +dependencies: + module: + - paragraphs +id: paragraph.field_reverse_layout +field_name: field_reverse_layout +entity_type: paragraph +type: boolean +settings: { } +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_text.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_text.yml new file mode 100644 index 0000000..508cf1b --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_text.yml @@ -0,0 +1,18 @@ +langcode: en +status: true +dependencies: + module: + - paragraphs +id: paragraph.field_text +field_name: field_text +entity_type: paragraph +type: string_long +settings: + case_sensitive: false +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_text_color.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_text_color.yml new file mode 100644 index 0000000..c160475 --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_text_color.yml @@ -0,0 +1,23 @@ +langcode: en +status: true +dependencies: + module: + - options + - paragraphs +id: paragraph.field_text_color +field_name: field_text_color +entity_type: paragraph +type: list_string +settings: + allowed_values: + - + value: white + label: White + allowed_values_function: '' +module: options +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_title.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_title.yml new file mode 100644 index 0000000..3c2861f --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_title.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + module: + - paragraphs +id: paragraph.field_title +field_name: field_title +entity_type: paragraph +type: string +settings: + max_length: 255 + case_sensitive: false + is_ascii: false +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_vertical_layout.yml b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_vertical_layout.yml new file mode 100644 index 0000000..bb882f4 --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/field.storage.paragraph.field_vertical_layout.yml @@ -0,0 +1,17 @@ +langcode: en +status: true +dependencies: + module: + - paragraphs +id: paragraph.field_vertical_layout +field_name: field_vertical_layout +entity_type: paragraph +type: boolean +settings: { } +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/edw_paragraphs_parallax_component/config/optional/paragraphs.paragraphs_type.parallax_component.yml b/modules/edw_paragraphs_parallax_component/config/optional/paragraphs.paragraphs_type.parallax_component.yml new file mode 100644 index 0000000..cc016fe --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/config/optional/paragraphs.paragraphs_type.parallax_component.yml @@ -0,0 +1,9 @@ +langcode: en +status: true +dependencies: { } +id: parallax_component +label: 'Parallax Component' +icon_uuid: null +icon_default: null +description: '' +behavior_plugins: { } diff --git a/modules/edw_paragraphs_parallax_component/css/parallax-component.css b/modules/edw_paragraphs_parallax_component/css/parallax-component.css new file mode 100644 index 0000000..9f53884 --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/css/parallax-component.css @@ -0,0 +1,94 @@ +.parallax-component { + display: flex; + flex-direction: column; + margin: 4rem auto; + max-width: 1320px; + padding: 2rem; +} + .parallax-component--full-width { + max-width: 100%; + width: 100%; +} + .parallax-component--full-width .parallax-component__title, .parallax-component--full-width .parallax-component__text { + text-align: center; +} + .parallax-component__title { + font-size: 2rem; + margin-bottom: 2rem; + line-height: 1.3; +} + .parallax-component__body { + display: flex; + justify-content: center; + align-items: center; + gap: 2rem; +} + .parallax-component__body > .parallax-component__image, .parallax-component__body > .parallax-component__text { + flex: 1; + padding: 1rem; +} + .parallax-component__body.layout-reverse { + flex-direction: row-reverse; +} + .parallax-component__body.layout-vertical { + flex-direction: column; +} + .parallax-component__body.layout-vertical-reverse { + flex-direction: column-reverse; +} + .parallax-component__image img { + width: 100%; + height: auto; + object-fit: cover; + display: block; + border-radius: 0.5rem; + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); +} + .parallax-component__text { + font-size: 1.25rem; + line-height: 1.6; + text-align: left; +} + @media (max-width: 768px) { + .parallax-component__body { + flex-direction: column; + } + .parallax-component__body.layout-reverse, .parallax-component__body.layout-vertical, .parallax-component__body.layout-vertical-reverse { + flex-direction: column; + } + .parallax-component__title { + font-size: 1.5rem; + margin-bottom: 1rem; + } + .parallax-component__text { + font-size: 1rem; + } + .parallax-component > .parallax-component__image, .parallax-component > .parallax-component__text { + padding: 0.5rem 0; + } +} + .parallax-component--bg-navy { + background-color: #003478; +} + .parallax-component--bg-yellow { + background-color: #fdc82f; +} + .parallax-component--bg-black { + background-color: #000; +} + .parallax-component--bg-light-blue { + background-color: #edf7fe; +} + .parallax-component--bg-gray { + background-color: #f2f2f2; +} + .parallax-component--bg-black-70 { + background-color: #4c4c4c; +} + .parallax-component--text-black .parallax-component__title, .parallax-component--text-black .parallax-component__text { + color: #000; +} + .parallax-component--text-white .parallax-component__title, .parallax-component--text-white .parallax-component__text { + color: #fff; +} + \ No newline at end of file diff --git a/modules/edw_paragraphs_parallax_component/edw_paragraphs_parallax_component.info.yml b/modules/edw_paragraphs_parallax_component/edw_paragraphs_parallax_component.info.yml new file mode 100644 index 0000000..1a0981b --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/edw_paragraphs_parallax_component.info.yml @@ -0,0 +1,7 @@ +name: EDW Paragraphs Parallax Component +description: Provides Parallax Component paragraph. +package: Eau de Web +type: module +core_version_requirement: ^9.4 || ^10 || ^11 +dependencies: + - edw_paragraphs:edw_paragraphs diff --git a/modules/edw_paragraphs_parallax_component/edw_paragraphs_parallax_component.libraries.yml b/modules/edw_paragraphs_parallax_component/edw_paragraphs_parallax_component.libraries.yml new file mode 100644 index 0000000..f8a2a69 --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/edw_paragraphs_parallax_component.libraries.yml @@ -0,0 +1,11 @@ +parallax_gsap: + css: + theme: + css/parallax-component.css: {} + js: + /libraries/gsap/dist/gsap.min.js: {} + /libraries/gsap/dist/ScrollTrigger.min.js: {} + js/parallax-gsap.js: {} + dependencies: + - core/jquery + - core/drupal \ No newline at end of file diff --git a/modules/edw_paragraphs_parallax_component/js/parallax-gsap.js b/modules/edw_paragraphs_parallax_component/js/parallax-gsap.js new file mode 100644 index 0000000..3e15662 --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/js/parallax-gsap.js @@ -0,0 +1,75 @@ +(function ($, Drupal, once) { + Drupal.behaviors.parallaxBehavior = { + attach: function (context) { + $(once('parallax', '.parallax-component', context)).each(function () { + const $component = $(this)[0]; + const image = $(this).find('.parallax-component__image')[0]; + const title = $(this).find('.parallax-component__title')[0]; + const text = $(this).find('.parallax-component__text')[0]; + + const imageAnim = $($component).data('animation-image') || 'none'; + const titleAnim = $($component).data('animation-title') || 'none'; + const textAnim = $($component).data('animation-text') || 'none'; + + gsap.registerPlugin(ScrollTrigger); + + function getAnimSettings(type) { + switch (type) { + case 'slide_up': return { y: 100, opacity: 0, duration: 1 }; + case 'slide_down': return { y: -100, opacity: 0, duration: 1 }; + case 'slide_left': return { x: -100, opacity: 0, duration: 1 }; + case 'slide_right': return { x: 100, opacity: 0, duration: 1 }; + default: return null; + } + } + + gsap.from($component, { + opacity: 0, + duration: 1, + scrollTrigger: { + trigger: $component, + start: "top 70%", + end: "bottom top", + toggleActions: "play none none reverse" + } + }); + + if (image && getAnimSettings(imageAnim)) { + gsap.from(image, { + ...getAnimSettings(imageAnim), + scrollTrigger: { + trigger: image, + start: "top 80%", + end: "bottom top", + toggleActions: "play none none reverse", + }, + }); + } + + if (title && getAnimSettings(titleAnim)) { + gsap.from(title, { + ...getAnimSettings(titleAnim), + scrollTrigger: { + trigger: title, + start: "top 90%", + end: "bottom top", + toggleActions: "play none none reverse", + }, + }); + } + + if (text && getAnimSettings(textAnim)) { + gsap.from(text, { + ...getAnimSettings(textAnim), + scrollTrigger: { + trigger: text, + start: "top 80%", + end: "bottom top", + toggleActions: "play none none reverse", + }, + }); + } + }); + } + }; +})(jQuery, Drupal, once); \ No newline at end of file diff --git a/modules/edw_paragraphs_parallax_component/templates/paragraph--parallax-component.html.twig b/modules/edw_paragraphs_parallax_component/templates/paragraph--parallax-component.html.twig new file mode 100644 index 0000000..fb4c7b0 --- /dev/null +++ b/modules/edw_paragraphs_parallax_component/templates/paragraph--parallax-component.html.twig @@ -0,0 +1,47 @@ +{{ attach_library('edw_paragraphs_parallax_component/parallax_gsap') }} + +{% + set classes = [ + 'paragraph', + 'paragraph--type--' ~ paragraph.bundle|clean_class, + view_mode ? 'paragraph--view-mode--' ~ view_mode|clean_class, + not paragraph.isPublished() ? 'paragraph--unpublished', + 'parallax-component', + paragraph.field_full_width.0.value ? 'parallax-component--full-width' : '', + paragraph.field_background_color.0.value ? 'parallax-component--bg-' ~ paragraph.field_background_color.0.value : '', + paragraph.field_text_color.0.value ? 'parallax-component--text-' ~ paragraph.field_text_color.0.value : '' + ] +%} + +{% + set layout_class = '' +%} +{% if paragraph.field_vertical_layout.value %} + {% if paragraph.field_reverse_layout.value %} + {% set layout_class = 'layout-vertical-reverse' %} + {% else %} + {% set layout_class = 'layout-vertical' %} + {% endif %} +{% elseif paragraph.field_reverse_layout.value %} + {% set layout_class = 'layout-reverse' %} +{% endif %} + +