Skip to content

Commit 692e31e

Browse files
committed
cleanup
1 parent ef7f112 commit 692e31e

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

v2/src/components/VShareToolsItem.vue

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
import { computed } from 'vue'
33
44
import AudioIcon from '../assets/icons/AudioIcon.vue'
5-
// eslint-disable-next-line import/no-duplicates
65
import EmailIcon from '../assets/icons/EmailIcon.vue'
76
import FacebookIcon from '../assets/icons/FacebookIcon.vue'
87
import InstagramIcon from '../assets/icons/InstagramIcon.vue'
98
import LinkedinIcon from '../assets/icons/LinkedinIcon.vue'
10-
// eslint-disable-next-line import/no-duplicates
11-
import NewsletterIcon from '../assets/icons/EmailIcon.vue'
129
import PhoneIcon from '../assets/icons/PhoneIcon.vue'
1310
import RedditIcon from '../assets/icons/RedditIcon.vue'
1411
import SiteIcon from '../assets/icons/SiteIcon.vue'
@@ -77,7 +74,7 @@ const icons = {
7774
homepage: LinkIcon,
7875
}
7976
80-
const URL_PLACEHOLDER_PATTERN = new RegExp('%URL%', 'g')
77+
const URL_PLACEHOLDER_PATTERN = /%URL%/g
8178
const SOCIAL_SERVICE_MAP = {
8279
spotify: {
8380
profileBase: 'https://open.spotify.com/playlist/',
@@ -140,20 +137,16 @@ const shareBase = computed(() => {
140137
})
141138
const shareUrl = computed(() => {
142139
const utmParams = Object.entries(props.utmParameters).map(([key, value]) => {
143-
return 'utm_' + key + '=' + encodeURIComponent(value)
140+
return `utm_${key}=${encodeURIComponent(value)}`
144141
})
145142
let url = props.url
146143
if (utmParams.length > 0) {
147-
url = url + '?' + utmParams.join('&')
144+
url = `${url}?${utmParams.join('&')}`
148145
}
149146
150147
const shareParams = Object.entries(props.shareParameters).map(
151148
([key, value]) => {
152-
return (
153-
key +
154-
'=' +
155-
encodeURIComponent(value.replace(URL_PLACEHOLDER_PATTERN, url))
156-
)
149+
return `${key}=${encodeURIComponent(value.replace(URL_PLACEHOLDER_PATTERN, url))}`
157150
}
158151
)
159152
@@ -162,23 +155,24 @@ const shareUrl = computed(() => {
162155
const shouldOmitUrl = SOCIAL_SERVICE_MAP[props.service]?.omitUrl
163156
if (!shouldOmitUrl) {
164157
const urlKey = SOCIAL_SERVICE_MAP[props.service]?.urlKey || 'url'
165-
const urlParam = urlKey + '=' + encodeURIComponent(url)
158+
const urlParam = `${urlKey}=${encodeURIComponent(url)}`
166159
params = [urlParam, ...params]
167160
}
168161
169-
return shareBase.value + '?' + params.join('&')
162+
return `${shareBase.value}?${params.join('&')}`
170163
})
171164
const ariaLabel = computed(() => {
172165
if (props.label) {
173166
return props.label
174167
} else if (props.action === 'follow') {
175-
return 'Follow us on ' + props.service
168+
return `Follow us on ${props.service}`
176169
} else if (props.action === 'share') {
177-
return 'Share on ' + props.service
170+
return `Share on ${props.service}`
178171
}
179172
return ''
180173
})
181174
175+
// create share popup
182176
const share = () => {
183177
if (!props.service) {
184178
return
@@ -200,7 +194,7 @@ const share = () => {
200194
const left = windowWidth / 2 - 600 / 2 + screenLeft
201195
const top = windowheight / 2 - 600 / 2 + screenTop
202196
203-
return { left: left, top: top }
197+
return { left, top }
204198
}
205199
206200
// get the position of the window

0 commit comments

Comments
 (0)