<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;
  transition: 0.2s;
  border: 1px solid $accentNeon;
  box-shadow: 0 0 10px 1px $accentNeon;
  background-color: transparent;
  border-radius: $default_border_radius;
  padding: 7px 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 1;

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

  @include hover {
    background-color: $accentNeon;
    color: $white;
  }

  &.active {
    background-color: $accentNeon;
    color: $white;
  }

  &:disabled {
    cursor: not-allowed;
    background-color: transparent;
    color: #fff;
  }

  &:disabled:hover, &.active {
    background-color: transparent;
    color: #fff;
  }

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