<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'
    }"
    v-html="textButton"
    @click="$emit('click')"
  ></button>
</template>

<script>
export default {
  name: "ButtonSimple",
  data() {
    return {
      padding: "7px 12px",
      fontSize: 13
    };
  },
  props: {
    textButton: {
      type: String,
      default: "Default button"
    },
    bg: {
      type: String,
      default: "#399333"
    },
    color: {
      type: String,
      default: "#ffffff"
    },
    fontWeight: {
      type: String,
      default: "normal"
    },
    borderRadius: {
      type: Number,
      default: 3
    },
    disabled: {
      type: Boolean,
      default: false
    },
    sm: {
      type: Boolean,
      default: false
    }
  },
  mounted() {
    if (this.sm) {
      this.padding = "5px 10px";
      this.fontSize = 12;
    }
  }
};
</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;
  }
}
</style>
