Files
webapp/app/components/ui/EmptyState.vue
2026-01-07 09:10:35 +07:00

51 lines
2.0 KiB
Vue

<template>
<div class="card bg-base-200 p-8 sm:p-12">
<div class="flex flex-col items-center text-center gap-4">
<div class="w-16 h-16 rounded-full bg-base-300 flex items-center justify-center">
<slot name="icon">
<svg class="w-8 h-8 text-base-content/40" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"/>
</svg>
</slot>
</div>
<div class="space-y-2">
<h3 class="text-lg font-semibold text-base-content">{{ title }}</h3>
<p v-if="description" class="text-base-content/70 max-w-md">{{ description }}</p>
</div>
<div v-if="actionLabel" class="mt-2">
<NuxtLink v-if="actionTo" :to="actionTo">
<button class="btn btn-primary gap-2">
<Icon v-if="actionIcon" :name="actionIcon" size="18" />
<svg v-else class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
</svg>
{{ actionLabel }}
</button>
</NuxtLink>
<button v-else class="btn btn-primary gap-2" @click="$emit('action')">
<Icon v-if="actionIcon" :name="actionIcon" size="18" />
<svg v-else class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
</svg>
{{ actionLabel }}
</button>
</div>
<slot />
</div>
</div>
</template>
<script setup lang="ts">
defineProps<{
title: string
description?: string
actionLabel?: string
actionTo?: string
actionIcon?: string
}>()
defineEmits<{
(e: 'action'): void
}>()
</script>