Skip to content

Commit

Permalink
fix(site): capture click on the svg
Browse files Browse the repository at this point in the history
  • Loading branch information
juanrgm committed Nov 13, 2024
1 parent e4c4575 commit 924830a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/spotty-clocks-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@dreamkit/site": patch
---

Fix playground buttons
15 changes: 10 additions & 5 deletions packages/site/src/components/Example.astro
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,17 @@ const { props } = Astro;
<script>
import openProject from "../utils/stackblitz.ts";
document.addEventListener("click", (e) => {
if (
e.target instanceof HTMLElement &&
e.target.matches("[data-project-code]")
) {
const element =
e.target instanceof HTMLElement
? e.target.matches("[data-project-code]")
? e.target
: undefined
: e.target instanceof Element
? (e.target.closest("[data-project-code]") as HTMLElement)
: undefined;
if (element) {
e.preventDefault();
openProject({ appCode: e.target.dataset.projectCode });
openProject({ appCode: element.dataset.projectCode });
}
});
</script>

0 comments on commit 924830a

Please sign in to comment.