Files
wallabicher/web/frontend/src/components/ToastNotification.vue
2026-01-20 18:15:49 +01:00

69 lines
2.6 KiB
Vue

<template>
<div
class="bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-xl p-3 max-w-sm min-w-[320px] backdrop-blur-sm"
>
<div class="flex items-start gap-3">
<div class="flex-shrink-0">
<img
v-if="toast.images"
:src="toast.images[0]"
:alt="toast.title"
class="w-12 h-12 object-cover rounded-lg"
@error="($event) => $event.target.style.display = 'none'"
/>
<div v-else class="w-12 h-12 bg-gradient-to-br from-gray-100 to-gray-200 dark:from-gray-700 dark:to-gray-600 rounded-lg flex items-center justify-center">
<span class="text-gray-400 text-lg">📦</span>
</div>
</div>
<div class="flex-1 min-w-0">
<div class="flex items-start justify-between gap-2">
<div class="flex-1 min-w-0">
<div class="flex items-center gap-2 mb-1">
<span
class="px-2 py-0.5 text-[10px] font-bold rounded-md uppercase tracking-wide"
:class="toast.platform === 'wallapop' ? 'bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-300' : 'bg-green-100 dark:bg-green-900/50 text-green-700 dark:text-green-300'"
>
{{ toast.platform?.toUpperCase() }}
</span>
</div>
<h4 class="font-semibold text-gray-900 dark:text-gray-100 text-sm mb-1 line-clamp-1 leading-tight">
{{ toast.title || 'Nuevo artículo' }}
</h4>
<p v-if="toast.price" class="text-base font-bold text-primary-600 dark:text-primary-400 mb-2">
{{ toast.price }} {{ toast.currency || '' }}
</p>
<a
v-if="toast.url"
:href="toast.url"
target="_blank"
rel="noopener noreferrer"
class="text-xs text-primary-600 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-300 hover:underline inline-flex items-center gap-1 font-medium"
>
Ver artículo
</a>
</div>
<button
@click="$emit('close')"
class="flex-shrink-0 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 text-sm leading-none p-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded transition-colors"
title="Cerrar"
>
</button>
</div>
</div>
</div>
</div>
</template>
<script setup>
defineProps({
toast: {
type: Object,
required: true,
},
});
defineEmits(['close']);
</script>