mirror of
https://github.com/namibia/awesome-cheatsheets.git
synced 2024-11-15 01:34:06 +00:00
feat(cheatsheet): handle logic for share buttons
This commit is contained in:
parent
f5dabeff07
commit
03e915e30c
@ -24,6 +24,7 @@
|
|||||||
.c-base-cheatsheet__share
|
.c-base-cheatsheet__share
|
||||||
base-share(
|
base-share(
|
||||||
v-for="network in networks"
|
v-for="network in networks"
|
||||||
|
@click="onShare"
|
||||||
:key="network"
|
:key="network"
|
||||||
:network="network"
|
:network="network"
|
||||||
class="c-base-cheatsheet__network"
|
class="c-base-cheatsheet__network"
|
||||||
@ -57,8 +58,30 @@ export default {
|
|||||||
baseUrl: process.env.baseUrl,
|
baseUrl: process.env.baseUrl,
|
||||||
|
|
||||||
// --> COMPONENTS <--
|
// --> COMPONENTS <--
|
||||||
networks: ["Slack", "Messenger", "Telegram", "Twitter", "LinkedIn"]
|
networks: ["Telegram", "Twitter", "LinkedIn"]
|
||||||
};
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
onShare(network) {
|
||||||
|
const link = this.link;
|
||||||
|
const socialNetwork = network.toLowerCase();
|
||||||
|
const technology = this.name;
|
||||||
|
let url = "";
|
||||||
|
let message = encodeURIComponent(
|
||||||
|
`Check this awesome cheatsheet about ${technology}: ${link} #${technology.toLowerCase()} #cheatsheet`
|
||||||
|
);
|
||||||
|
|
||||||
|
if (socialNetwork === "telegram") {
|
||||||
|
url = `https://telegram.me/share/url?url=${link}&text=${message}`;
|
||||||
|
} else if (socialNetwork === "twitter") {
|
||||||
|
url = `https://twitter.com/intent/tweet?text=${message}`;
|
||||||
|
} else if (socialNetwork === "linkedin") {
|
||||||
|
url = `https://www.linkedin.com/shareArticle?mini=true&url=${link}&source=LinkedIn`;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.open(url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -70,7 +70,7 @@ $c: ".c-the-github-buttons";
|
|||||||
#{$c} {
|
#{$c} {
|
||||||
#{$c}__wrapper {
|
#{$c}__wrapper {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 10px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
#{$c}__button {
|
#{$c}__button {
|
||||||
@ -103,6 +103,7 @@ $c: ".c-the-github-buttons";
|
|||||||
#{$c} {
|
#{$c} {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
margin-bottom: 0;
|
||||||
|
|
||||||
#{$c}__wrapper {
|
#{$c}__wrapper {
|
||||||
width: initial;
|
width: initial;
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
user="LeCoupa"
|
user="LeCoupa"
|
||||||
class="c-index__github-buttons"
|
class="c-index__github-buttons"
|
||||||
)
|
)
|
||||||
|
|
||||||
section(
|
section(
|
||||||
v-for="(category, index) in categories"
|
v-for="(category, index) in categories"
|
||||||
:key="category.name"
|
:key="category.name"
|
||||||
|
Loading…
Reference in New Issue
Block a user