<template>
  <div class="skeleton-table rounded-3 overflow-hidden border text-start bg-white">
    <div class="table-header bg-light p-3 border-bottom d-flex align-items-center">
        <SkeletonBlock v-for="n in parseInt(columns)" :key="n" :width="colWidth" height="16px" margin="0 15px 0 0" borderRadius="4px" />
    </div>
    <div v-for="row in parseInt(rows)" :key="row" class="table-row p-3 border-bottom d-flex align-items-center">
        <SkeletonBlock v-for="n in parseInt(columns)" :key="n" :width="colWidth" height="12px" margin="0 15px 0 0" borderRadius="4px" />
    </div>
  </div>
</template>

<script setup>
import SkeletonBlock from './SkeletonBlock.vue';

defineProps({
  rows: { type: [Number, String], default: 6 },
  columns: { type: [Number, String], default: 4 },
  colWidth: { type: String, default: '18%' }
})
</script>

<style scoped>
.skeleton-table {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}
.table-row:last-child {
    border-bottom: none !important;
}
:global(.dark-mode) .skeleton-table {
    background: #1f2228 !important;
}
:global(.dark-mode) .table-header {
    background: #2d3138 !important;
}
</style>
