2018-09-09 17:46:23 +00:00
|
|
|
<!-- *************************************************************************
|
|
|
|
TEMPLATE
|
|
|
|
************************************************************************* -->
|
|
|
|
|
|
|
|
<template lang="pug">
|
2018-09-09 21:05:03 +00:00
|
|
|
.c-base-cheatsheet
|
|
|
|
a(
|
|
|
|
:href="link"
|
|
|
|
class="c-base-cheatsheet__link"
|
|
|
|
target="_blank"
|
2018-09-09 17:46:23 +00:00
|
|
|
)
|
2018-09-09 21:05:03 +00:00
|
|
|
img(
|
2018-09-09 21:57:04 +00:00
|
|
|
:src="baseUrl + '/images/components/BaseCheatsheet/' + thumbnail"
|
2018-09-09 21:05:03 +00:00
|
|
|
class="c-base-cheatsheet__thumbnail"
|
|
|
|
)
|
|
|
|
|
2018-09-09 17:46:23 +00:00
|
|
|
.c-base-cheatsheet__content
|
2018-09-09 21:05:03 +00:00
|
|
|
a(
|
|
|
|
:href="link"
|
|
|
|
class="c-base-cheatsheet__name"
|
|
|
|
target="_blank"
|
|
|
|
) The {{ name }} Cheatsheet
|
2018-09-09 18:07:59 +00:00
|
|
|
|
|
|
|
.c-base-cheatsheet__share
|
2018-09-09 21:05:03 +00:00
|
|
|
base-share(
|
2018-09-09 18:07:59 +00:00
|
|
|
v-for="network in networks"
|
2018-09-10 09:46:53 +00:00
|
|
|
@click="onShare"
|
2018-09-09 21:05:03 +00:00
|
|
|
:key="network"
|
|
|
|
:network="network"
|
|
|
|
class="c-base-cheatsheet__network"
|
2018-09-09 18:07:59 +00:00
|
|
|
)
|
2018-09-09 17:46:23 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<!-- *************************************************************************
|
|
|
|
SCRIPT
|
|
|
|
************************************************************************* -->
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
2018-09-09 18:07:59 +00:00
|
|
|
link: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
2018-09-09 17:46:23 +00:00
|
|
|
name: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
thumbnail: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
}
|
2018-09-09 18:07:59 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2018-09-09 21:57:04 +00:00
|
|
|
// --> STATE <--
|
|
|
|
baseUrl: process.env.baseUrl,
|
|
|
|
|
2018-09-09 18:07:59 +00:00
|
|
|
// --> COMPONENTS <--
|
2018-09-11 14:21:25 +00:00
|
|
|
networks: ["Facebook", "Twitter", "LinkedIn", "Telegram"]
|
2018-09-09 18:07:59 +00:00
|
|
|
};
|
2018-09-10 09:46:53 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
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`
|
|
|
|
);
|
|
|
|
|
2018-09-10 12:24:08 +00:00
|
|
|
if (socialNetwork === "facebook") {
|
|
|
|
url = `https://www.facebook.com/sharer/sharer.php?u=${link}`;
|
|
|
|
} else if (socialNetwork === "telegram") {
|
2018-09-10 09:46:53 +00:00
|
|
|
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);
|
|
|
|
}
|
2018-09-09 17:46:23 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<!-- *************************************************************************
|
|
|
|
STYLE
|
|
|
|
************************************************************************* -->
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
$c: ".c-base-cheatsheet";
|
|
|
|
|
|
|
|
#{$c} {
|
2018-09-09 18:07:59 +00:00
|
|
|
display: block;
|
2018-09-09 17:46:23 +00:00
|
|
|
padding: 10px;
|
2018-09-09 23:14:07 +00:00
|
|
|
border: 1px solid $oxford-blue;
|
2018-09-09 21:05:03 +00:00
|
|
|
border-radius: 6px;
|
2018-09-09 23:14:07 +00:00
|
|
|
background: $ebony-clay;
|
2018-09-09 17:46:23 +00:00
|
|
|
|
2018-09-09 21:05:03 +00:00
|
|
|
#{$c}__link {
|
|
|
|
#{$c}__thumbnail {
|
|
|
|
width: 100%;
|
|
|
|
height: 160px;
|
|
|
|
border-radius: 4px;
|
2018-09-09 21:16:45 +00:00
|
|
|
user-select: none;
|
2018-09-09 21:05:03 +00:00
|
|
|
}
|
2018-09-09 17:46:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#{$c}__content {
|
|
|
|
padding: 10px;
|
|
|
|
text-align: left;
|
|
|
|
|
|
|
|
#{$c}__name {
|
|
|
|
margin-bottom: 20px;
|
2018-09-09 23:14:07 +00:00
|
|
|
color: $white;
|
2018-09-09 17:46:23 +00:00
|
|
|
font-size: 18px;
|
|
|
|
}
|
2018-09-09 21:05:03 +00:00
|
|
|
|
|
|
|
#{$c}__share {
|
|
|
|
margin-top: 12px;
|
|
|
|
display: flex;
|
2018-09-09 21:16:45 +00:00
|
|
|
user-select: none;
|
2018-09-09 21:05:03 +00:00
|
|
|
|
|
|
|
#{$c}__network {
|
|
|
|
margin-right: 6px;
|
|
|
|
|
|
|
|
&:last-of-type {
|
|
|
|
margin-right: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-09-09 17:46:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|