You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.9 KiB

<template>
<button
class="share-button share-button--instapaper"
type="button"
:url="url"
:description="description"
:btnText="btnText"
:modalWidth="modalWidth"
:modalHeight="modalHeight"
:hasIcon="hasIcon"
:isBlank="isBlank"
@click="openShareWindow"
>
<icon iconName="Instapaper" class="share-button__icon" v-if="hasIcon === true">
<path
d="M14.766 20.259c0 1.819.271 2.089 2.934 2.292V24H6.301v-1.449c2.666-.203 2.934-.473 2.934-2.292V3.708c0-1.784-.27-2.089-2.934-2.292V0h11.398v1.416c-2.662.203-2.934.506-2.934 2.292v16.551z"
/>
</icon>
<span class="share-button__text" v-if="btnText">{{btnText}}</span>
</button>
</template>
<script>
import Icon from "./icon/Icon.vue";
import {
getDocumentHref,
getDocumentTitle,
eventEmit,
createWindow
} from "../helpers";
export default {
name: "InstapaperShareButton",
components: { Icon },
props: {
url: { type: String, default: getDocumentHref },
description: { type: String, default: getDocumentTitle },
btnText: { type: String, default: "Instapaper" },
modalWidth: { type: Number, default: 500 },
modalHeight: { type: Number, default: 500 },
hasIcon: { type: Boolean, default: true },
isBlank: { type: Boolean, default: true }
},
methods: {
openShareWindow() {
eventEmit(this, "onShare", { name: "Instapaper" });
const configWindow = createWindow(
this.$props.modalWidth,
this.$props.modalHeight
);
const url = `https://www.instapaper.com/edit?url=${encodeURIComponent(
this.$props.url
)}&title=${encodeURIComponent(this.$props.description)}`;
return this.$props.isBlank
? window.open(url, "__blank")
: window.open(url, "Share this", configWindow);
}
}
};
</script>
<style>
@import "../style/index.css";
@import "../style/instapaperButton.css";
</style>