<template>
  <div class="vc-loader__card">
    <div
      :style="[phRowHeight]"
      class="ph-row flex justify-between items-center mb-10"
    >
      <div class="ph-cell w-5/12" />
      <div class="ph-cell empty" />
      <div class="ph-cell mini" />
      <div class="ph-cell mini" />
    </div>
    <div
      :style="[phRowHeight]"
      class="ph-row flex justify-between items-center mb-4"
    >
      <div class="ph-cell w-8/12" />
    </div>
    <div
      :style="[phRowHeight]"
      class="ph-row flex justify-between items-center mb-4"
    >
      <div class="ph-cell w-10/12" />
    </div>
    <div
      :style="[phRowHeight]"
      class="ph-row flex justify-between items-center"
    >
      <div class="ph-cell w-6/12" />
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'

const DEFAULT_HEIGHT_ROW = '25px'

export default defineComponent({
  name: 'Card',
  props: {
    rowHeight: {
      type: [Number, String],
      default: undefined
    }
  },
  computed: {
    phRowHeight () {
      const height = this.rowHeight || DEFAULT_HEIGHT_ROW
      return {
        height
      }
    }
  }
})
</script>

<style lang="scss" scoped>
  .vc-loader__card {
    @apply rounded bg-white p-4 h-full;
    min-height: 204px;

    .ph-row {
      .ph-cell {
        @apply h-full rounded-xs bg-skeleton-loader;

        &:not(:first-child) {
          @apply ml-4;
        }
        &.mini {
          @apply flex-shrink-0;
          width: 3.125rem;
        }
        &.empty {
          @apply bg-white flex-grow;
        }
      }
    }
  }
</style>
