summaryrefslogtreecommitdiff
path: root/examples/with-tailwindcss/src/components/Button.astro
blob: 79060699bbdfb81aa965eb21d0f1e565cc3906f8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
---
// Click button, get confetti!
// Styled by Tailwind :)
---

<button
	class="py-2 px-4 bg-purple-500 text-white font-semibold rounded-lg shadow-md hover:bg-purple-700 focus:outline-none focus:ring-2 focus:ring-purple-400 focus:ring-opacity-75"
>
	<slot />
</button>

<script>
	import confetti from 'canvas-confetti';
	const button = document.body.querySelector('button');

	if (button) {
		button.addEventListener('click', () => confetti());
	}
</script>