All files / src/components EmptyState.vue

0% Statements 0/0
0% Branches 6/6
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24                                               
<template>
  <!-- No <p>: its bottom margin would sit inside the alert, under the text -->
  <div class="empty-state" :class="grid ? `text-center py-${padding}` : undefined">
    <div v-if="variant === 'info'" class="alert alert-info" role="alert">
      <font-awesome-icon v-if="icon" :icon="icon" class="me-2" /><slot />
    </div>
    <div v-else class="text-muted" :class="{ 'mb-3': !grid }"><slot /></div>
  </div>
</template>
 
<script setup lang="ts">
withDefaults(
  defineProps<{
    variant?: 'plain' | 'info'
    icon?: string
    // Centers the message with vertical padding, as list pages show it;
    // disable for a message inside a card, a tab or a panel.
    grid?: boolean
    padding?: number
  }>(),
  { variant: 'plain', icon: undefined, grid: true, padding: 4 }
)
</script>