|
32 | 32 | require([ |
33 | 33 | "../dist/pfe-cta.umd.js", |
34 | 34 | "../../pfe-band/dist/pfe-band.umd.js", |
35 | | - "../../pfe-card/dist/pfe-card.umd.js" |
| 35 | + "../../pfe-card/dist/pfe-card.umd.js", |
| 36 | + "../../pfe-icon/dist/pfe-icon.umd.js" |
36 | 37 | ]); |
37 | 38 | </script> |
38 | 39 | </head> |
@@ -237,6 +238,24 @@ <h3>Link and button styles (displayed inline)</h3> |
237 | 238 | </div> |
238 | 239 | </pfe-band> |
239 | 240 |
|
| 241 | + <pfe-band> |
| 242 | + <h2 slot="pfe-band--header">CTA Events</h2> |
| 243 | + <div class="card-layout"> |
| 244 | + <pfe-card pfe-size="small"> |
| 245 | + <div id="events" class="cta-align"> |
| 246 | + <pfe-cta><a href="https://www.redhat.com">Visit redhat.com</a></pfe-cta> |
| 247 | + <pfe-cta pfe-priority="primary"><a href="https://www.redhat.com">Primary Link</a></pfe-cta> |
| 248 | + <pfe-cta pfe-priority="secondary"><a href="https://www.redhat.com">Secondary Link</a></pfe-cta> |
| 249 | + </div> |
| 250 | + <div id="events-footer" class="event-registry" slot="pfe-card--footer" pfe-overflow="right left bottom" hidden> |
| 251 | + <pfe-icon icon="rh-safety-warning-alert" size="lg"></pfe-icon> |
| 252 | + <span>"pfe-cta:select" event registered on call-to-action.</span> |
| 253 | + See console for details. |
| 254 | + </div> |
| 255 | + </pfe-card> |
| 256 | + </div> |
| 257 | + </pfe-band> |
| 258 | + |
240 | 259 | <br /> |
241 | 260 | <hr /> |
242 | 261 | <br /> |
@@ -301,7 +320,22 @@ <h3 style="color: white">Color override</h3> |
301 | 320 | </pfe-cta> |
302 | 321 | </div> |
303 | 322 | </div> |
| 323 | + <script> |
| 324 | + const eventsFooter = document.querySelector("#events-footer"); |
| 325 | + |
| 326 | + document.querySelector("#events").addEventListener("pfe-cta:select", function (event) { |
| 327 | + event.preventDefault(); |
| 328 | + eventsFooter.removeAttribute("hidden"); |
| 329 | + console.log(event); |
| 330 | + }); |
| 331 | + |
| 332 | + const ctas = document.querySelectorAll("#events pfe-cta"); |
| 333 | + for (var i = 0; i < ctas.length; i++) { |
| 334 | + ctas[i].addEventListener("click", function (event) { |
| 335 | + event.preventDefault(); |
| 336 | + }); |
| 337 | + } |
| 338 | + </script> |
304 | 339 | </body> |
305 | 340 |
|
306 | 341 | </html> |
307 | | - |
|
0 commit comments