Skip to content

Commit 87ce5a0

Browse files
committed
feat: add SocialShare component to ShareLinks component
1 parent 08a0e80 commit 87ce5a0

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

app.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<div v-else-if="domain">
2727
No results could be fetched. Is it a valid domain?
2828
</div>
29-
<TheShareLink v-if="crux || lighthouse" :domain="domain" :type="crux ? 'crux' : 'pagespeed-insights'"
29+
<ShareLinks v-if="crux || lighthouse" :domain="domain" :type="crux ? 'crux' : 'pagespeed-insights'"
3030
:timestamp="crux && cruxStatus !== 'pending' ? crux.timestamp : lighthouse && lighthouseStatus !== 'pending' ? lighthouse.timestamp : undefined" />
3131
<details class="max-w-[500px] text-gray-400">
3232
<summary class="cursor-pointer">

components/TheShareLink.vue renamed to components/ShareLinks.vue

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const text = computed(() => props.domain
1515
1616
const canonicalURL = computed(() => props.domain ? joinURL(`https://page-speed.dev`, props.domain) : 'https://page-speed.dev')
1717
const shareLink = computed(() =>
18-
'https://twitter.com/intent/tweet?text=' +
1918
(props.domain ? encodeURIComponent([text.value, canonicalURL.value].join('\n\n')) : text.value)
2019
)
2120
@@ -38,11 +37,18 @@ async function nativeShare () {
3837

3938
<template>
4039
<div class="flex flex-col gap-2 mt-auto md:mt-8">
41-
<NuxtLink type="submit"
42-
class="bg-green-400 text-black hover: hover:bg-white focus:bg-white active:bg-white text-xl md:text-2xl py-2 px-6 md:self-start mb-8"
43-
:href="shareLink" @click.prevent="nativeShare">
44-
share results
45-
</NuxtLink>
40+
<div class="self-start text-gray-400">Share results</div>
41+
<div class="flex flex-row gap-2 mb-7">
42+
<SocialShare
43+
v-for="network in ['twitter', 'whatsapp', 'telegram', 'reddit', 'pocket', 'email']"
44+
:key="network"
45+
:network="network"
46+
:styled="true"
47+
:label="false"
48+
class="p-3 rounded-full opacity-70 hover:opacity-100"
49+
:url="shareLink"
50+
/>
51+
</div>
4652
<a v-if="type === 'crux'"
4753
:href="`https://lookerstudio.google.com/c/u/0/reporting/bbc5698d-57bb-4969-9e07-68810b9fa348/page/keDQB?params=%7B%22origin%22:%22https://${domain}%22%7D`"
4854
class="self-start underline text-gray-400 hover:text-green-400 focus:text-green-400 active:text-green-400">

0 commit comments

Comments
 (0)