<template>
  <button
    type="button"
    :class="$style.btn"
    :disabled="disabled"
    :style="{
      'background-color': bg,
      'border-color': bg,
      color: color,
      padding: padding,
      'font-size': fontSize + 'px',
      'font-weight': fontWeight,
      'border-radius': borderRadius + 'px',
    }"
    @click="$emit('click')"
  >
    <div :class="$style.btnAlign">
      <IconBase
        v-if="visibleIcon === true"
        :name="nameIcon"
        :size="fontSizeIcon"
        :color="colorIcon"
        :style="{
          'margin-right': '3px',
        }"
      />
      {{ textButton }}
      <IconBase
        v-if="visibleIcon === false"
        :name="nameIcon"
        :size="fontSizeIcon"
        :color="colorIcon"
        :style="{
          'margin-left': '3px',
        }"
      />
    </div>
  </button>
</template>

<script>
import IconBase from "../Icons/IconBase.vue";
export default {
  name: "ButtonIcon",
  props: {
    textButton: {
      type: String,
      default: "Siguiente",
    },
    bg: {
      type: String,
      default: "#399333",
    },
    color: {
      type: String,
      default: "#ffffff",
    },
    padding: {
      type: String,
      default: "7px 12px",
    },
    fontWeight: {
      type: String,
      default: "normal",
    },
    fontSize: {
      type: Number,
      default: 13,
    },
    borderRadius: {
      type: Number,
      default: 3,
    },
    disabled: {
      type: Boolean,
      default: false,
    },
    colorIcon: {
      type: String,
      default: "#ffffff",
    },
    fontSizeIcon: {
      type: Number,
      default: 8,
    },
    nameIcon: {
      type: String,
      default: "next",
    },
    visibleIcon: {
      type: Boolean,
      default: true,
    },
  },
  components: {
    IconBase,
  },
};
</script>

<style lang="scss" module>
.btn {
  display: inline-block;
  margin-bottom: 0;
  text-align: center;
  vertical-align: middle;
  touch-action: manipulation;
  cursor: pointer;
  background-image: none;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.5384616;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  outline: none;
  -webkit-transition: all ease-in-out 0.15s;
  -o-transition: all ease-in-out 0.15s;
  transition: all ease-in-out 0.15s;
  &:hover {
    opacity: 0.9;
  }
  &:disabled {
    opacity: 0.6;
    cursor: not-allowed;
  }
}

.btnAlign {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-direction: row;
}
</style>