|
1 | 1 | {%- comment -%} |
2 | 2 | This snippet uses Variable Scope and can be re-used throughout the theme. |
3 | | -To use this snippet in sections, add {%- include, key: value -%} with some assigned variables. |
| 3 | +To use this snippet in sections, add {%- render, key: value -%} with assigned variables. |
4 | 4 | For Example: |
| 5 | +This is the target button id that will open the modal. |
| 6 | +<button id="modalBtn">TEST MODAL</button> |
5 | 7 | ========================================================================= |
6 | | -{%- include "dynamic-modal", |
7 | | - id: "homePageTestModal", |
8 | | - openModalBtn: "testButton", |
9 | | - title: "Testing Title Variable", |
10 | | - body: "Testing the Dynamic Body Of the Modal..." |
| 8 | +Here is a render tag example to use in the section with some example variables declared. |
| 9 | +Note the openModalBtn matches the button element above which triggers the modal in this example. |
| 10 | +========================================================================= |
| 11 | +{%- render 'dynamic-modal', |
| 12 | + id: "testModal", |
| 13 | + openModalBtn: "modalBtn", |
| 14 | + title: "Modal Title", |
| 15 | + body: "Modal Body", |
| 16 | + buttonOne: "Button One", |
| 17 | + buttonOneStyle: "text-white bg-blue-500 hover:bg-blue-700", |
| 18 | + buttonOneFunction: "javascript:void(0);", |
| 19 | + buttonTwo: "Button Two", |
| 20 | + buttonTwoStyle: "text-white bg-transparent hover:bg-blue-700 text-blue-500 hover:text-white border border-blue-500 hover:border-transparent", |
| 21 | + buttonTwoFunction: "javascript:void(0);" |
11 | 22 | -%} |
12 | 23 | ========================================================================= |
13 | | -These 👆 will change the default assignments below 👇 |
| 24 | +id, openModalBtn, title and body are required. If you don't want buttons make the value = null. |
| 25 | +========================================================================= |
14 | 26 | {%- endcomment -%} |
15 | | -{%- assign id = "defaultModal" -%} |
16 | | -{%- assign openModalBtn = "defaultOpenButton" -%} |
17 | | -{%- assign title = "Modal Title" -%} |
18 | | -{%- assign body = "Modal Body" -%} |
19 | | -{%- assign buttonOne = null -%} |
20 | | -{%- assign buttonOneStyle = "text-white bg-blue-500 hover:bg-blue-700" -%} |
21 | | -{%- assign buttonOneFunction = "javascript:void(0);" -%} |
22 | | -{%- assign buttonTwo = null -%} |
23 | | -{%- assign buttonTwoStyle = "text-white bg-transparent hover:bg-blue-700 text-blue-500 hover:text-white border border-blue-500 hover:border-transparent" -%} |
24 | | -{%- assign buttonTwoFunction = "javascript:void(0);" -%} |
25 | 27 |
|
26 | 28 | <section class="hidden" id="{{ id }}"> |
27 | | - <div class="flex items-center justify-center fixed left-0 bottom-0 w-full h-full bg-black bg-opacity-75" id="modalContainer"> |
| 29 | + <div class="flex items-center justify-center fixed left-0 bottom-0 w-full h-full bg-black bg-opacity-75 z-50" id="modalContainer"> |
28 | 30 | <div class="bg-white rounded-lg w-1/2"> |
29 | 31 | <div class="flex flex-col items-start p-4"> |
30 | 32 | <div class="flex items-center w-full"> |
|
0 commit comments