<script setup lang="ts">

defineProps<{
  buttonStyle?: string,
  icon?: string,
  buttonType?: "button" | "submit" | "reset" | undefined,
  disabled?: boolean
}>()
defineEmits(['click'])
</script>
<template>
  <button class="app-button" :class="{ 'app-button-secondary': buttonStyle === 'secondary' }" @click="$emit('click')"
    :type="buttonType" :disabled="disabled ?? false">
    <span v-if="icon">
      <font-awesome-icon :icon="'fa-' + icon" style="margin-right: 0.5rem; margin-left: -0.5rem;"></font-awesome-icon>
    </span>
    <slot></slot>
  </button>
</template>
<style lang="css">
.app-button {
  background-color: #111827;
  border: 1px solid transparent;
  border-radius: .75rem;
  box-sizing: border-box;
  color: #FFFFFF;
  cursor: pointer;
  flex: 0 0 auto;
  font-family: "OpenSans", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1rem;
  padding: .75rem 1.5rem;
  text-align: center;
  text-decoration: none #6B7280 solid;
  text-decoration-thickness: auto;
  transition-duration: .2s;
  transition-property: background-color, border-color, color, fill, stroke;
  transition-timing-function: cubic-bezier(.4, 0, 0.2, 1);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  width: auto;
  margin: 0.25rem;
}

.app-button:hover {
  background-color: #374151;
}

.app-button:focus {
  box-shadow: none;
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.app-button:active {
  background-color: #3b4968;

}

@media (min-width: 768px) {
  .app-button {
    padding: .75rem 1.5rem;
  }
}

.app-button-secondary {
  background-color: #1d2330;
}
</style>
