Skip to content

Commit 341310d

Browse files
committed
Adding event detail to demo page
1 parent bd8483b commit 341310d

File tree

2 files changed

+41
-3
lines changed

2 files changed

+41
-3
lines changed

elements/pfe-cta/demo/demo.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ pfe-band[pfe-color="lightest"] pfe-card[pfe-color="lightest"] {
1212
--pfe-card--Border: 1px solid rgba(45, 45, 45, 0.3);
1313
}
1414

15+
[hidden] {
16+
display: none !important;
17+
}
18+
1519
.default-link-test {
1620
display: flex;
1721
flex-flow: row nowrap;
@@ -83,4 +87,4 @@ pfe-band[pfe-color="lightest"] pfe-card[pfe-color="lightest"] {
8387
padding: 15px;
8488
background: #0c8488;
8589
--theme: saturated;
86-
}
90+
}

elements/pfe-cta/demo/index.html

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
require([
3333
"../dist/pfe-cta.umd.js",
3434
"../../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"
3637
]);
3738
</script>
3839
</head>
@@ -237,6 +238,24 @@ <h3>Link and button styles (displayed inline)</h3>
237238
</div>
238239
</pfe-band>
239240

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+
240259
<br />
241260
<hr />
242261
<br />
@@ -301,7 +320,22 @@ <h3 style="color: white">Color override</h3>
301320
</pfe-cta>
302321
</div>
303322
</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>
304339
</body>
305340

306341
</html>
307-

0 commit comments

Comments
 (0)