<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">
          <div class="sk__content-inner">
            <el-skeleton-item
                variant="p"
                class="sk__brand"
            />
            <el-skeleton-item
                variant="p"
                class="sk__name"
            />
            <el-skeleton-item
                variant="p"
                class="sk__rating"
            />
            <el-skeleton-item
                variant="p"
                class="sk__price"
            />
          </div>
          <div class="sk__buttons">
            <el-skeleton-item
                variant="p"
                class="sk__button"
            />
          </div>
        </div>
      </div>
    </template>
  </el-skeleton>
</template>

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

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

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

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

      &-wrapper {
        width: 100%;
        padding: 0;
        display: flex;
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
      }

      &-inner {
        align-self: flex-start;
      }
    }

    & .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: 200px;
    border-radius: $default_border_radius;
  }

  &__content {
    &-wrapper {
      padding: 10px 20px 20px 20px;
      display: flex;
      flex-direction: column;
      gap: 16px;
    }

    &-inner {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
  }

  &__price {
    width: 50px;
    height: 20px;
  }

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

  &__rating {
    margin-block: 4px 10px;
    width: 120px;
    height: 16px;
  }

  &__brand {
    width: 75px;
    height: 15px;
  }

  &__buttons {
    width: 100%;
  }

  &__button {
    width: 100%;
    height: 40px;
  }
}
</style>