From fe941306077cd1c116110c72ecf1e3a1db8fd279 Mon Sep 17 00:00:00 2001 From: Alexandrshy Date: Wed, 20 Mar 2019 07:56:08 +0400 Subject: [PATCH] Added new share button: blogger, digg, livejournal, renren, vk, weibo --- src/App.vue | 146 ++++++++++++++++++++++++++- src/components/BloggerButton.vue | 71 +++++++++++++ src/components/DiggButton.vue | 69 +++++++++++++ src/components/LiveJournalButton.vue | 69 +++++++++++++ src/components/RenrenButton.vue | 72 +++++++++++++ src/components/TwitterButton.vue | 20 ++-- src/components/VkontakteButton.vue | 72 +++++++++++++ src/components/WeiboButton.vue | 71 +++++++++++++ src/components/index.js | 0 src/helpers/documentData.js | 2 + src/style/bloggerButton.css | 43 ++++++++ src/style/diggButton.css | 43 ++++++++ src/style/livejournalButton.css | 45 +++++++++ src/style/renrenButton.css | 43 ++++++++ src/style/twitterButton.css | 2 +- src/style/vkontakteButton.css | 43 ++++++++ src/style/weiboButton.css | 43 ++++++++ 17 files changed, 846 insertions(+), 8 deletions(-) create mode 100644 src/components/BloggerButton.vue create mode 100644 src/components/DiggButton.vue create mode 100644 src/components/LiveJournalButton.vue create mode 100644 src/components/RenrenButton.vue create mode 100644 src/components/VkontakteButton.vue create mode 100644 src/components/WeiboButton.vue delete mode 100644 src/components/index.js create mode 100644 src/style/bloggerButton.css create mode 100644 src/style/diggButton.css create mode 100644 src/style/livejournalButton.css create mode 100644 src/style/renrenButton.css create mode 100644 src/style/vkontakteButton.css create mode 100644 src/style/weiboButton.css diff --git a/src/App.vue b/src/App.vue index 4f36d64..1d89fbd 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,19 +6,163 @@ + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + +
diff --git a/src/components/BloggerButton.vue b/src/components/BloggerButton.vue new file mode 100644 index 0000000..572e286 --- /dev/null +++ b/src/components/BloggerButton.vue @@ -0,0 +1,71 @@ + + + + + diff --git a/src/components/DiggButton.vue b/src/components/DiggButton.vue new file mode 100644 index 0000000..cbd1b02 --- /dev/null +++ b/src/components/DiggButton.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/src/components/LiveJournalButton.vue b/src/components/LiveJournalButton.vue new file mode 100644 index 0000000..c4e7233 --- /dev/null +++ b/src/components/LiveJournalButton.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/src/components/RenrenButton.vue b/src/components/RenrenButton.vue new file mode 100644 index 0000000..f56f434 --- /dev/null +++ b/src/components/RenrenButton.vue @@ -0,0 +1,72 @@ + + + + + diff --git a/src/components/TwitterButton.vue b/src/components/TwitterButton.vue index ea4509c..c94d40f 100644 --- a/src/components/TwitterButton.vue +++ b/src/components/TwitterButton.vue @@ -3,9 +3,13 @@ class="share-button share-button--twitter" type="button" :class="className" - :pageUrl="pageUrl" + :shareUrl="shareUrl" + :shareTitle="shareTitle" :shareText="shareText" + :sharePic="sharePic" :btnText="btnText" + :windowWidth="windowWidth" + :windowHeight="windowHeight" :hasIcon="hasIcon" :isBlank="isBlank" @click="openShareWindow" @@ -29,13 +33,17 @@ import { } from "../helpers"; export default { - name: "twitter-button", + name: "TwitterShareButton", components: { Icon }, props: { className: { type: String }, - pageUrl: { type: String, deflate: getDocumentHref }, + shareUrl: { type: String, default: getDocumentHref }, + shareTitle: { type: String }, shareText: { type: String, default: getDocumentTitle }, + sharePic: { type: String, default: "" }, btnText: { type: String, default: "Twitter" }, + windowWidth: { type: Number }, + windowHeight: { type: Number }, hasIcon: { type: Boolean, default: true }, isBlank: { type: Boolean, default: true } }, @@ -43,9 +51,9 @@ export default { openShareWindow: function() { eventEmit(this, { name: "Twitter" }); const configWindow = createWindow(); - const url = `https://twitter.com/share?url=${this.$props.pageUrl}&text=${ - this.$props.shareText - }`; + const url = `https://twitter.com/share?url=${encodeURIComponent( + this.$props.shareUrl + )}&text=${encodeURIComponent(this.$props.shareText)}`; return this.$props.isBlank ? window.open(url, "__blank") diff --git a/src/components/VkontakteButton.vue b/src/components/VkontakteButton.vue new file mode 100644 index 0000000..5d71462 --- /dev/null +++ b/src/components/VkontakteButton.vue @@ -0,0 +1,72 @@ + + + + + diff --git a/src/components/WeiboButton.vue b/src/components/WeiboButton.vue new file mode 100644 index 0000000..7b64814 --- /dev/null +++ b/src/components/WeiboButton.vue @@ -0,0 +1,71 @@ + + + + + diff --git a/src/components/index.js b/src/components/index.js deleted file mode 100644 index e69de29..0000000 diff --git a/src/helpers/documentData.js b/src/helpers/documentData.js index 0741d4b..b34b0fa 100644 --- a/src/helpers/documentData.js +++ b/src/helpers/documentData.js @@ -7,5 +7,7 @@ export const getDocumentHref = () => document.location.href; /** * Get title for page. + * + * @returns {string} - Page title. */ export const getDocumentTitle = () => document.title; diff --git a/src/style/bloggerButton.css b/src/style/bloggerButton.css new file mode 100644 index 0000000..cef3629 --- /dev/null +++ b/src/style/bloggerButton.css @@ -0,0 +1,43 @@ +/* blogger */ +.share-button--blogger { + background-color: hsla(195, 100%, 46%, 1); +} + +.share-button--blogger:focus { + box-shadow: 0 0 0 3px hsla(195, 94%, 71%, 0.4); +} + +.share-button--blogger:hover { + background-color: hsla(195, 100%, 46%, 0.9); +} + +.share-button--blogger .share-button__icon path { + fill: #fff; +} + +/* Circle */ +.share-button--blogger.share-button--outline { + background-color: transparent; + border-color: hsl(195, 100%, 46%, 1); +} + +.share-button--blogger.share-button--outline:hover { + background-color: transparent; + border-color: hsla(195, 100%, 46%, 0.9); +} + +.share-button--blogger.share-button--outline .share-button__text { + color: hsla(195, 100%, 46%, 1); +} + +.share-button--blogger.share-button--outline:hover .share-button__text { + color: hsla(195, 100%, 46%, 0.9); +} + +.share-button--blogger.share-button--outline .share-button__icon path { + fill: hsla(195, 100%, 46%, 1); +} + +.share-button--blogger.share-button--outline:hover .share-button__icon path { + fill: hsla(195, 100%, 46%, 0.9); +} diff --git a/src/style/diggButton.css b/src/style/diggButton.css new file mode 100644 index 0000000..feb88fa --- /dev/null +++ b/src/style/diggButton.css @@ -0,0 +1,43 @@ +/* digg */ +.share-button--digg { + background-color: hsla(0, 0%, 0%, 1); +} + +.share-button--digg:focus { + box-shadow: 0 0 0 3px hsla(0, 0%, 25%, 0.4); +} + +.share-button--digg:hover { + background-color: hsla(0, 0%, 0%, 0.9); +} + +.share-button--digg .share-button__icon path { + fill: #fff; +} + +/* Circle */ +.share-button--digg.share-button--outline { + background-color: transparent; + border-color: hsl(0, 0%, 0%, 1); +} + +.share-button--digg.share-button--outline:hover { + background-color: transparent; + border-color: hsla(0, 0%, 0%, 0.9); +} + +.share-button--digg.share-button--outline .share-button__text { + color: hsla(0, 0%, 0%, 1); +} + +.share-button--digg.share-button--outline:hover .share-button__text { + color: hsla(0, 0%, 0%, 0.9); +} + +.share-button--digg.share-button--outline .share-button__icon path { + fill: hsla(0, 0%, 0%, 1); +} + +.share-button--digg.share-button--outline:hover .share-button__icon path { + fill: hsla(0, 0%, 0%, 0.9); +} diff --git a/src/style/livejournalButton.css b/src/style/livejournalButton.css new file mode 100644 index 0000000..6e9646f --- /dev/null +++ b/src/style/livejournalButton.css @@ -0,0 +1,45 @@ +/* livejournal */ +.share-button--livejournal { + background-color: hsla(195, 100%, 46%, 1); +} + +.share-button--livejournal:focus { + box-shadow: 0 0 0 3px hsla(195, 94%, 71%, 0.4); +} + +.share-button--livejournal:hover { + background-color: hsla(195, 100%, 46%, 0.9); +} + +.share-button--livejournal .share-button__icon path { + fill: #fff; +} + +/* Circle */ +.share-button--livejournal.share-button--outline { + background-color: transparent; + border-color: hsl(195, 100%, 46%, 1); +} + +.share-button--livejournal.share-button--outline:hover { + background-color: transparent; + border-color: hsla(195, 100%, 46%, 0.9); +} + +.share-button--livejournal.share-button--outline .share-button__text { + color: hsla(195, 100%, 46%, 1); +} + +.share-button--livejournal.share-button--outline:hover .share-button__text { + color: hsla(195, 100%, 46%, 0.9); +} + +.share-button--livejournal.share-button--outline .share-button__icon path { + fill: hsla(195, 100%, 46%, 1); +} + +.share-button--livejournal.share-button--outline:hover + .share-button__icon + path { + fill: hsla(195, 100%, 46%, 0.9); +} diff --git a/src/style/renrenButton.css b/src/style/renrenButton.css new file mode 100644 index 0000000..966d1db --- /dev/null +++ b/src/style/renrenButton.css @@ -0,0 +1,43 @@ +/* Renren */ +.share-button--renren { + background-color: hsla(207, 71%, 45%, 1); +} + +.share-button--renren:focus { + box-shadow: 0 0 0 3px hsla(207, 65%, 50%, 0.4); +} + +.share-button--renren:hover { + background-color: hsla(207, 71%, 45%, 0.9); +} + +.share-button--renren .share-button__icon path { + fill: #fff; +} + +/* Circle */ +.share-button--renren.share-button--outline { + background-color: transparent; + border-color: hsl(207, 71%, 45%, 1); +} + +.share-button--renren.share-button--outline:hover { + background-color: transparent; + border-color: hsla(207, 71%, 45%, 0.9); +} + +.share-button--renren.share-button--outline .share-button__text { + color: hsla(207, 71%, 45%, 1); +} + +.share-button--renren.share-button--outline:hover .share-button__text { + color: hsla(207, 71%, 45%, 0.9); +} + +.share-button--renren.share-button--outline .share-button__icon path { + fill: hsla(207, 71%, 45%, 1); +} + +.share-button--renren.share-button--outline:hover .share-button__icon path { + fill: hsla(207, 71%, 45%, 0.9); +} diff --git a/src/style/twitterButton.css b/src/style/twitterButton.css index ec929b9..158506a 100644 --- a/src/style/twitterButton.css +++ b/src/style/twitterButton.css @@ -1,6 +1,6 @@ /* Twitter */ .share-button--twitter { - background-color: hsla(203, 88%, 53%, 1); + background-color: hsla(203, 89%, 53%, 1); } .share-button--twitter:focus { diff --git a/src/style/vkontakteButton.css b/src/style/vkontakteButton.css new file mode 100644 index 0000000..5a88d33 --- /dev/null +++ b/src/style/vkontakteButton.css @@ -0,0 +1,43 @@ +/* vk */ +.share-button--vk { + background-color: hsla(212, 28%, 52%, 1); +} + +.share-button--vk:focus { + box-shadow: 0 0 0 3px hsla(212, 22%, 77%, 0.4); +} + +.share-button--vk:hover { + background-color: hsla(212, 28%, 52%, 0.9); +} + +.share-button--vk .share-button__icon path { + fill: #fff; +} + +/* Circle */ +.share-button--vk.share-button--outline { + background-color: transparent; + border-color: hsla(212, 28%, 52%, 1); +} + +.share-button--vk.share-button--outline:hover { + background-color: transparent; + border-color: hsla(212, 28%, 52%, 0.9); +} + +.share-button--vk.share-button--outline .share-button__text { + color: hsla(212, 28%, 52%, 1); +} + +.share-button--vk.share-button--outline:hover .share-button__text { + color: hsla(212, 28%, 52%, 0.9); +} + +.share-button--vk.share-button--outline .share-button__icon path { + fill: hsla(212, 28%, 52%, 1); +} + +.share-button--vk.share-button--outline:hover .share-button__icon path { + fill: hsla(212, 28%, 52%, 0.9); +} diff --git a/src/style/weiboButton.css b/src/style/weiboButton.css new file mode 100644 index 0000000..bfd4005 --- /dev/null +++ b/src/style/weiboButton.css @@ -0,0 +1,43 @@ +/* weibo */ +.share-button--weibo { + background-color: hsl(353, 83%, 49%); +} + +.share-button--weibo:focus { + box-shadow: 0 0 0 3px hsla(353, 100%, 74%, 0.4); +} + +.share-button--weibo:hover { + background-color: hsla(353, 83%, 49%, 0.9); +} + +.share-button--weibo .share-button__icon path { + fill: #fff; +} + +/* Circle */ +.share-button--weibo.share-button--outline { + background-color: transparent; + border-color: hsl(353, 83%, 49%, 1); +} + +.share-button--weibo.share-button--outline:hover { + background-color: transparent; + border-color: hsla(353, 83%, 49%, 0.9); +} + +.share-button--weibo.share-button--outline .share-button__text { + color: hsla(353, 83%, 49%, 1); +} + +.share-button--weibo.share-button--outline:hover .share-button__text { + color: hsla(353, 83%, 49%, 0.9); +} + +.share-button--weibo.share-button--outline .share-button__icon path { + fill: hsla(353, 83%, 49%, 1); +} + +.share-button--weibo.share-button--outline:hover .share-button__icon path { + fill: hsla(353, 83%, 49%, 0.9); +}