<template>
  <div class="pfe-button" :class="`type-${type} size-${size}`">
    <i v-if="icon" class="iconfont left-icon">{{ icon }}</i>
    <span>{{ text }}</span>
    <i v-if="rightIcon" class="iconfont right-icon">{{ rightIcon }}</i>
  </div>
</template>

<script>
import { defineComponent } from 'vue';

export default defineComponent({
  props: {
    type: {
      type: String,
      default: 'default'
    },
    size: {
      type: String,
      default: 'default'
    },
    text: {
      type: String,
      default: ''
    },
    icon: {
      type: String,
      default: ''
    },
    rightIcon: {
      type: String,
      default: ''
    }
  },
  setup() {
    return {};
  }
});
</script>

<style lang="scss" scoped>
.pfe-button {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border-radius: 4px;
  cursor: pointer;

  .left-icon {
    margin-right: 6px;
    font-size: 20px;
  }

  .right-icon {
    margin-left: 6px;
    font-size: 20px;
  }
}

.type-primary {
  border: 1px solid #70b936;
  background: #70b936;
  color: #fff;
}

.type-primary:hover {
  border: 1px solid #70b936;
  background: #70b936;
}

.type-default {
  border: 1px solid #70b936;
  background-color: #fff;
  color: #70b936;
}

.type-default:hover {
  color: #70b936;
}

.size-default {
  height: 42px;
  padding: 0 20px;
  font-size: 16px;
  line-height: 24px;
}

.size-small {
  height: 32px;
  padding: 0 16px;
  font-size: 14px;
  line-height: 22px;

  .left-icon {
    margin-right: 4px;
    font-size: 16px;
  }

  .right-icon {
    margin-left: 4px;
    font-size: 16px;
  }
}
</style>
