Skip to content

Commit

Permalink
refactor: ♻️ replace icon at mapping level
Browse files Browse the repository at this point in the history
  • Loading branch information
waitingallday committed Oct 16, 2023
1 parent 76d3233 commit b2eb2fd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
12 changes: 1 addition & 11 deletions packages/nuxt-ripple/composables/use-tide-site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,7 @@ export const useTideSite = async (id?: number): Promise<TideSiteData> => {
return data.value
}

// Intercept social links, replace icon-twitter with icon-x
return Object.fromEntries(
Object.entries(siteData.value).map(([k, v]) => [
k,
k !== 'socialLinks'
? v
: siteData.value[k].map((link: any) =>
link.icon === 'icon-twitter' ? { ...link, icon: 'icon-x' } : link
)
])
) as any
return siteData.value
}

export default useTideSite
3 changes: 2 additions & 1 deletion packages/nuxt-ripple/mapping/utils/processSiteSocialLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export const getIconForUrl = (urlString: string) => {
case 'linkedin.com':
return 'icon-linkedin'
case 'twitter.com':
return 'icon-twitter'
case 'x.com':
return 'icon-x'
case 'youtube.com':
return 'icon-youtube'
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const handleClick = (event) => {
)
}
// Intercept social links to replace icon-twitter with icon-x
// Replace icon-twitter with icon-x
const socialLinks = computed(() =>
props.items.map((i) =>
i.icon === 'icon-twitter' ? { ...i, icon: 'icon-x' } : i
Expand Down

0 comments on commit b2eb2fd

Please sign in to comment.