Skip to content

Commit

Permalink
Merge pull request #137 from joe-irving/136-add-source-codes-to-petit…
Browse files Browse the repository at this point in the history
…ion-share-buttons

add sources to share urls
  • Loading branch information
joe-irving authored Jun 9, 2024
2 parents 8ec504b + 1e4de5b commit 822241a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions components/ShareTile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,22 @@ const props = defineProps({
}
})
const sourcedUrl = (source: string) => {
const url = new URL(props.url)
url.searchParams.set('source', source)
return url.toString()
}
const shareButtonLinks = ref({
facebook: `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(
props.url
)}`,
sourcedUrl('facebook')
)}&src=sdkpreparse`,
twitter: `https://twitter.com/intent/tweet?text=${encodeURIComponent(
props.tweet || props.description || ''
)}&url=${encodeURIComponent(props.url)}`,
)}&url=${encodeURIComponent(sourcedUrl('twitter'))}`,
whatsapp: `https://wa.me/?text=${encodeURIComponent(
props.whatsapp || props.description || ''
)}+${props.url}`
)}+${sourcedUrl('whatsapp')}`
})
const isCopied = ref(false)
Expand Down

0 comments on commit 822241a

Please sign in to comment.