Skip to content

Commit

Permalink
preventDefault on Contact onClick only when $crisp is there (#1795)
Browse files Browse the repository at this point in the history
  • Loading branch information
hasparus authored Nov 11, 2024
1 parent 3e6147b commit 223a8ad
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/cuddly-shoes-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@theguild/components': patch
---

Call event.preventDefault on Contact onClick only if $crisp is there
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ export function GetYourAPIGameRightSection({ className }: { className?: string }
variant="tertiary"
href="https://the-guild.dev/contact"
onClick={event => {
window.$crisp?.push(['do', 'chat:open']);
event.preventDefault();
if (window.$crisp) {
window.$crisp.push(['do', 'chat:open']);
event.preventDefault();
}
}}
>
Talk to us
Expand Down
6 changes: 4 additions & 2 deletions packages/components/src/components/hive-footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ export function HiveFooter({
className="hive-focus -m-2 rounded p-2 font-medium hover:text-blue-700 hover:underline dark:hover:text-blue-100"
href="https://the-guild.dev/contact"
onClick={event => {
window.$crisp?.push(['do', 'chat:open']);
event.preventDefault();
if (window.$crisp) {
window.$crisp.push(['do', 'chat:open']);
event.preventDefault();
}
}}
>
Contact Us
Expand Down
6 changes: 4 additions & 2 deletions packages/components/src/components/hive-navigation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,10 @@ export function HiveNavigation({
target="_blank"
rel="noopener noreferrer"
onClick={event => {
window.$crisp?.push(['do', 'chat:open']);
event.preventDefault();
if (window.$crisp) {
window.$crisp.push(['do', 'chat:open']);
event.preventDefault();
}
}}
>
Contact <span className="hidden xl:contents">us</span>
Expand Down

0 comments on commit 223a8ad

Please sign in to comment.