2020-06-30 11:36:10 +02:00
|
|
|
const SOCIAL_PLATFORMS = {
|
2020-06-21 09:07:57 +02:00
|
|
|
default: {
|
|
|
|
name: "default",
|
|
|
|
imgPos: [0,0], // [row,col]
|
|
|
|
},
|
|
|
|
|
|
|
|
facebook: {
|
|
|
|
name: "Facebook",
|
|
|
|
imgPos: [0,1],
|
|
|
|
},
|
|
|
|
twitter: {
|
|
|
|
name: "Twitter",
|
|
|
|
imgPos: [0,2],
|
|
|
|
},
|
|
|
|
instagram: {
|
|
|
|
name: "Instagram",
|
|
|
|
imgPos: [0,3],
|
|
|
|
},
|
2020-06-29 01:19:26 +02:00
|
|
|
snapchat: {
|
2020-06-21 09:07:57 +02:00
|
|
|
name: "Snapchat",
|
|
|
|
imgPos: [0,4],
|
|
|
|
},
|
|
|
|
tiktok: {
|
|
|
|
name: "TikTok",
|
|
|
|
imgPos: [0,5],
|
|
|
|
},
|
|
|
|
soundcloud: {
|
|
|
|
name: "Soundcloud",
|
|
|
|
imgPos: [0,6],
|
|
|
|
},
|
2020-06-29 01:19:26 +02:00
|
|
|
bandcamp: {
|
|
|
|
name: "Bandcamp",
|
2020-06-21 09:07:57 +02:00
|
|
|
imgPos: [0,7],
|
|
|
|
},
|
|
|
|
patreon: {
|
|
|
|
name: "Patreon",
|
|
|
|
imgPos: [0,1],
|
|
|
|
},
|
|
|
|
youtube: {
|
|
|
|
name: "YouTube",
|
|
|
|
imgPos: [0,9 ],
|
|
|
|
},
|
|
|
|
spotify: {
|
|
|
|
name: "Spotify",
|
|
|
|
imgPos: [0,10],
|
|
|
|
},
|
|
|
|
twitch: {
|
|
|
|
name: "Twitch",
|
|
|
|
imgPos: [0,11],
|
|
|
|
},
|
|
|
|
paypal: {
|
|
|
|
name: "Paypal",
|
|
|
|
imgPos: [0,12],
|
|
|
|
},
|
|
|
|
github: {
|
|
|
|
name: "Github",
|
|
|
|
imgPos: [0,13],
|
|
|
|
},
|
|
|
|
linkedin: {
|
|
|
|
name: "LinkedIn",
|
|
|
|
imgPos: [0,14],
|
|
|
|
},
|
|
|
|
discord: {
|
|
|
|
name: "Discord",
|
|
|
|
imgPos: [0,15],
|
|
|
|
},
|
2020-07-08 08:03:22 +02:00
|
|
|
mastodon: {
|
|
|
|
name: "Mastodon",
|
2020-06-21 09:07:57 +02:00
|
|
|
imgPos: [0,16],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
Vue.component('social-list', {
|
|
|
|
props: ['platforms'],
|
|
|
|
|
|
|
|
template: `
|
2020-07-04 03:07:57 +02:00
|
|
|
<ul class="social-list flex" v-if="this.platforms.length">
|
|
|
|
<span class="follow-label">Follow me: </span>
|
2020-06-21 09:07:57 +02:00
|
|
|
<user-social-icon
|
|
|
|
v-for="(item, index) in this.platforms"
|
2020-07-04 03:07:57 +02:00
|
|
|
v-if="item.platform && item.url"
|
2020-06-21 09:07:57 +02:00
|
|
|
v-bind:key="index"
|
|
|
|
v-bind:platform="item.platform"
|
2020-06-30 11:36:10 +02:00
|
|
|
v-bind:url="item.url"
|
2020-06-21 09:07:57 +02:00
|
|
|
/>
|
2020-06-21 10:31:08 +02:00
|
|
|
</ul>
|
2020-06-21 09:07:57 +02:00
|
|
|
`,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
Vue.component('user-social-icon', {
|
2020-06-30 11:36:10 +02:00
|
|
|
props: ['platform', 'url'],
|
2020-06-21 09:07:57 +02:00
|
|
|
data: function() {
|
2020-06-30 11:36:10 +02:00
|
|
|
const platformInfo = SOCIAL_PLATFORMS[this.platform.toLowerCase()];
|
|
|
|
const inList = !!platformInfo;
|
2020-07-04 03:07:57 +02:00
|
|
|
const imgRow = inList ? platformInfo.imgPos[0] : 0;
|
|
|
|
const imgCol = inList ? platformInfo.imgPos[1] : 0;
|
2020-06-21 09:07:57 +02:00
|
|
|
return {
|
2020-06-30 11:36:10 +02:00
|
|
|
name: inList ? platformInfo.name : this.platform,
|
2020-07-04 03:07:57 +02:00
|
|
|
link: this.url,
|
2020-06-30 11:36:10 +02:00
|
|
|
|
2020-06-21 09:07:57 +02:00
|
|
|
style: `--imgRow: -${imgRow}; --imgCol: -${imgCol};`,
|
|
|
|
itemClass: {
|
|
|
|
"user-social-item": true,
|
|
|
|
"flex": true,
|
2020-07-04 03:07:57 +02:00
|
|
|
"use-default": !inList,
|
2020-06-21 09:07:57 +02:00
|
|
|
},
|
|
|
|
labelClass: {
|
|
|
|
"platform-label": true,
|
2020-07-04 03:07:57 +02:00
|
|
|
"visually-hidden": inList,
|
2020-06-21 09:07:57 +02:00
|
|
|
"text-indigo-800": true,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
},
|
|
|
|
template: `
|
2020-06-21 10:31:08 +02:00
|
|
|
<li>
|
|
|
|
<a
|
|
|
|
v-bind:class="itemClass"
|
|
|
|
target="_blank"
|
|
|
|
:href="link"
|
|
|
|
>
|
|
|
|
<span class="platform-icon rounded-lg" :style="style" />
|
2020-06-30 11:36:10 +02:00
|
|
|
<span v-bind:class="labelClass">Find me on {{platform}}</span>
|
2020-06-21 10:31:08 +02:00
|
|
|
</a>
|
|
|
|
</li>
|
2020-06-21 09:07:57 +02:00
|
|
|
`,
|
|
|
|
});
|