<div style="padding: 20px; display: flex; flex-direction: column; gap: 16px;">
<div style="display: flex; align-items: center; gap: 12px; flex-wrap: wrap;">
<button
class="ina-button ina-button--custom ina-button--sm"
style="background-color: var(--ina-content-primary); color: white; border: 1px solid var(--ina-content-primary);"
id="toast-btn-default"
>
Show Default Toast
</button>
<button
class="ina-button ina-button--custom ina-button--sm"
style="background-color: var(--ina-negative-50); color: var(--ina-negative-600); border: 1px solid var(--ina-negative-600);"
id="toast-btn-destructive"
>
Show Destructive Toast
</button>
<button
class="ina-button ina-button--custom ina-button--sm"
style="background-color: var(--ina-positive-50); color: var(--ina-positive-600); border: 1px solid var(--ina-positive-600);"
id="toast-btn-positive"
>
Show Positive Toast
</button>
</div>
</div>
<!-- No container needed, handled by JS -->
<script is:inline>
(function () {
function attachListeners() {
const btnDefault = document.getElementById('toast-btn-default');
const btnDestructive = document.getElementById('toast-btn-destructive');
const btnPositive = document.getElementById('toast-btn-positive');
console.log('[Toast Example 1] Buttons found:', {
default: !!btnDefault,
destructive: !!btnDestructive,
positive: !!btnPositive,
});
btnDefault?.addEventListener('click', () => {
console.log('[Toast Example 1] Default button clicked');
if (window.InaUI && window.InaUI.showToast) {
window.InaUI.showToast({
title: 'Information',
message: 'This is a default toast message.',
state: 'default',
position: 'top-right',
});
} else {
console.error('window.InaUI.showToast not found');
}
});
btnDestructive?.addEventListener('click', () => {
console.log('[Toast Example 1] Destructive button clicked');
if (window.InaUI && window.InaUI.showToast) {
window.InaUI.showToast({
title: 'Error',
message: 'This is a destructive toast message.',
state: 'destructive',
position: 'top-right',
});
}
});
btnPositive?.addEventListener('click', () => {
console.log('[Toast Example 1] Positive button clicked');
if (window.InaUI && window.InaUI.showToast) {
window.InaUI.showToast({
title: 'Success',
message: 'This is a positive toast message.',
state: 'positive',
position: 'top-right',
});
}
});
}
// Run immediately
attachListeners();
// Re-run on view transitions if needed
document.addEventListener('astro:page-load', attachListeners);
})();
</script>