UNPKG

vue-socials

Version:

Social media share buttons and counts for Vue.js

45 lines (41 loc) 1.91 kB
import { defineComponent } from 'vue'; import BaseSocials from '../../mixins/BaseSocial/BaseSocial.js'; import getSerialisedParams from '../../utils/getSerialisedParams.js'; import getSeparatedList from '../../utils/getSeparatedList.js'; /** * Hey! * * SDevTo component used for DevTo social network * @link https://dev.to/ * @example https://dev.to/new?prefill=%0A%20%20%20%20%20%20%20%20---%0A%20%20%20%20%20%20%20%20title%3ATitle%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20tags%3Atag%0A%20%20%20%20%20%20%20%20---%0A%20%20%20%20%20%20%20%20Text%201%0AText%202%0A%7B%25%20wikipedia%20https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FWikipedia%20%25%7D */ /** * Share parameters for link * @link https://dev.to/devteam/announcing-off-platform-share-to-dev-functionality-57j9 */ var SDevTo = /* #__PURE__ */defineComponent({ name: 'SDevTo', mixins: [BaseSocials('DevTo')], computed: { networkURL: function networkURL() { var BASE_URL = 'https://dev.to/new'; var shareOptions = this.shareOptions; var title = shareOptions.title, isPublished = shareOptions.isPublished, tags = shareOptions.tags, content = shareOptions.content; var formattedTitle = title ? "title:".concat(title) : ''; var formattedPublish = isPublished ? "published:".concat(isPublished) : ''; var formattedTags = tags ? "tags:".concat(getSeparatedList(tags, ', ')) : ''; var formattedContent = content || ''; var serialisedParams = getSerialisedParams({ prefill: "\n ---\n ".concat(formattedTitle, "\n ").concat(formattedPublish, "\n ").concat(formattedTags, "\n ---\n ").concat(formattedContent) }); return "".concat(BASE_URL).concat(serialisedParams); } }, render: function render() { return this.generateComponent(this.networkURL); } }); export default SDevTo;