<template>
  <el-skeleton
      class="sk"
      :class="[{'sk__list': isList }]"
      animated
  >
    <template #template>
      <div class="sk__content">
        <el-skeleton-item
            variant="image"
            class="sk__image"
        />
        <div class="sk__content-wrapper">
          <el-skeleton-item
              variant="p"
              class="sk__price"
          />
          <el-skeleton-item
              variant="p"
              class="sk__name"
          />
          <el-skeleton-item
              variant="p"
              class="sk__rating"
          />
          <el-skeleton-item
              variant="p"
              class="sk__quantity"
          />
        </div>
      </div>
      <div class="sk__buttons">
        <el-skeleton-item
            variant="p"
            class="sk__button"
        />
        <el-skeleton-item
            variant="p"
            class="sk__button"
        />
      </div>
    </template>
  </el-skeleton>
</template>

<script setup lang="ts">
const props = defineProps<{
  isList?: boolean
}>()
</script>

<style lang="scss" scoped>
.sk {
  width: 100%;
  border-radius: $default_border_radius;
  background-color: rgba(255, 255, 255, 0.61);
  border: 2px solid $accent;
  display: flex;
  flex-direction: column;

  &__list {
    flex-direction: row;
    align-items: flex-start;
    padding: 10px;

    & .sk__content {
      width: 100%;
      display: flex;
      flex-direction: row;

      &-wrapper {
        width: 100%;
        padding-top: 0;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
      }
    }

    & .sk__image {
      width: 150px;
      height: 150px;
    }

    & .sk__price {
      width: 100px;
    }

    & .sk__quantity {
      width: 100px;
    }

    & .sk__buttons {
      width: fit-content;
      margin-top: 0;
      flex-direction: column;
      align-items: flex-end;
    }

    & .sk__button {
      &:first-child {
        width: 140px;
      }
    }
  }

  &__image {
    width: 100%;
    height: 220px;
    border-radius: $default_border_radius;
  }

  &__content {
    &-wrapper {
      padding: 24px 20px 20px 20px;
    }
  }

  &__price {
    width: 35%;
    height: 25px;
  }

  &__name {
    width: 100%;
    height: 75px;
  }

  &__rating {
    width: 120px;
    height: 40px;
  }

  &__quantity {
    width: 50%;
    height: 18px;
  }

  &__buttons {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding: 0 20px 20px 20px;
  }

  &__button {
    width: 100%;
    height: 34px;

    &:last-child {
      width: 34px;
      flex-shrink: 0;
    }
  }
}
</style>