<template>
  <button
      type="button"
      class="button"
      :disabled="isDisabled"
      :class="[{active: isLoading}]"
  >
    <ui-loader class="button__loader" v-if="isLoading" />
    <slot v-else />
  </button>
</template>

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

<style lang="scss" scoped>
.button {
  position: relative;
  width: fit-content;
  cursor: pointer;
  flex-shrink: 0;
  border: 1px solid $text;
  box-shadow: 0 0 10px 1px $text;
  background-color: transparent;
  border-radius: $less_border_radius;
  padding: 7px 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 1;

  color: $text;
  text-shadow: 0 0 10px $text;
  text-align: center;
  font-size: 16px;
  font-weight: 500;

  @include hover {
    background-color: $text;
    color: $main;
  }

  &.active {
    background-color: $text;
    color: $main;
  }

  &:disabled {
    cursor: not-allowed;
    background-color: transparent;
    color: $main;
  }

  &:disabled:hover, &.active {
    background-color: transparent;
    color: $main;
  }

  &__loader {
    margin-block: 4px;
  }
}
</style>