Skip to content
This repository was archived by the owner on May 24, 2021. It is now read-only.

Commit f77fb4b

Browse files
grantfosteralexander-heimbuch
authored andcommitted
feat(tabs/share, icon): Add a linkedin share button
Many podcasts are targeted toward professionals who are always on LinkedIn. This change uses the shareArticle endpoint of the LinkedIn API and adds a new icon and Channel component.
1 parent 95c3988 commit f77fb4b

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

src/components/icons/LinkedinIcon.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<template>
2+
<svg role="img" width="30" height="30" viewBox="0 0 24 24">
3+
<path :fill="color" d="M19 0h-14c-2.761 0-5 2.239-5 5v14c0 2.761 2.239 5 5 5h14c2.762 0 5-2.239 5-5v-14c0-2.761-2.238-5-5-5zm-11 19h-3v-11h3v11zm-1.5-12.268c-.966 0-1.75-.79-1.75-1.764s.784-1.764 1.75-1.764 1.75.79 1.75 1.764-.783 1.764-1.75 1.764zm13.5 12.268h-3v-5.604c0-3.368-4-3.113-4 0v5.604h-3v-11h3v1.765c1.396-2.586 7-2.777 7 2.476v6.759z"/>
4+
</svg>
5+
</template>
6+
7+
<script>
8+
export default {
9+
props: ['color']
10+
}
11+
</script>

src/components/tabs/share/ShareChannels.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<li id="tab-share--channels--pinterest"><channel-pinterest-component :text="shareText" :link="shareLink" :poster="sharePoster"></channel-pinterest-component></li>
66
<li id="tab-share--channels--reddit"><channel-reddit-component :text="shareText" :link="shareLink"></channel-reddit-component></li>
77
<li id="tab-share--channels--mail"><channel-mail-component :text="shareText" :subject="shareSubject"></channel-mail-component></li>
8+
<li id="tab-share--channels--linkedin"><channel-linkedin-component :text="shareText" :link="shareLink"></channel-linkedin-component></li>
89
<li id="tab-share--channels--embed" v-if="type !== 'show' && ((reference.config && reference.share) || reference.origin)">
910
<channel-embed-component :color="theme.tabs.share.platform.button"></channel-embed-component>
1011
</li>
@@ -24,6 +25,7 @@
2425
import ChannelEmbedComponent from './channels/ChannelEmbed'
2526
import ChannelPinterestComponent from './channels/ChannelPinterest'
2627
import ChannelRedditComponent from './channels/ChannelReddit'
28+
import ChannelLinkedinComponent from './channels/ChannelLinkedin'
2729
2830
export default {
2931
props: ['type'],
@@ -133,7 +135,8 @@
133135
ChannelMailComponent,
134136
ChannelEmbedComponent,
135137
ChannelPinterestComponent,
136-
ChannelRedditComponent
138+
ChannelRedditComponent,
139+
ChannelLinkedinComponent
137140
}
138141
}
139142
</script>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<template>
2+
<a :href="linkedinLink" class="channel-link" target="_blank">
3+
<span class="channel-icon Linkedin" aria-hidden="true"><Linkedin-icon color="#fff"></Linkedin-icon></span>
4+
<span class="visually-hidden">{{ $t('A11Y.SHARE_CHANNEL', { channel: 'Linkedin' }) }}</span>
5+
</a>
6+
</template>
7+
8+
<script>
9+
import LinkedinIcon from 'icons/LinkedinIcon'
10+
import { addQueryParameter } from 'utils/url'
11+
12+
const LINK = 'https://www.linkedin.com/shareArticle'
13+
14+
export default {
15+
props: ['link', 'color', 'text'],
16+
computed: {
17+
linkedinLink () {
18+
return addQueryParameter(LINK, { url: this.link, mini: true, summary: this.text })
19+
}
20+
},
21+
components: {
22+
LinkedinIcon
23+
}
24+
}
25+
</script>
26+
27+
<style lang="scss">
28+
$channel-color: #0077B5;
29+
30+
.channel-icon.Linkedin {
31+
background-color: $channel-color;
32+
}
33+
</style>

0 commit comments

Comments
 (0)