Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/lowmess/az-golf-gurus. www.azgolfgurus.com
astro datocms typescript
Something went wrong. Try again.
746 B · 33 lines
Astro
at main
12345678910111213141516171819202122232425262728293031323334---import Button, { type ButtonProps } from "#components/Button.astro";
type Props = Omit<ButtonProps<"button">, "as"> & { url: string;};
const { url, ...props } = Astro.props;---
<Button data-url={url} {...props}><slot /></Button>
<script> // Calendly widget does not have types // eslint-disable-next-line @typescript-eslint/no-explicit-any declare let Calendly: any;
const buttons: NodeListOf<HTMLButtonElement> = document.querySelectorAll("button[data-url]");
buttons.forEach((button) => { button.addEventListener("click", () => { const url = button.dataset.url;
if (!url || !typeof Calendly) { console.warn("Calendly missing"); return false; }
Calendly.initPopupWidget({ url }); }); });</script>