<template>
  <n-btn
    color="white"
    class="pkg-base-n-share-btn n-color-main-font n-font-normal"
    prepend-icon="n-icon-export-3 n-icon-size-22"
    v-on="$listeners"
    @click="onShare"
  >
    {{ label }}
  </n-btn>
</template>

<script>
import { defineComponent } from "vue";
import NBtn from "../NButton/n-button.vue";

export default defineComponent({
  name: "NSahreButton",
  components: {
    NBtn,
  },
  props: {
    wrapperClass: {
      type: String,
      default: "",
    },
    label: {
      type: String,
      default: "",
    },
  },
  methods: {
    onShare() {
      const url = window.location.href;

      navigator.clipboard.writeText(url);

      this.$emit("share", url);
    },
  },
});
</script>

<style scoped>
.pkg-base-n-share-btn {
  border: 1px solid #d9dde0;
}
</style>
