Skip to content

Commit

Permalink
feat: ✨ replace twitter with x
Browse files Browse the repository at this point in the history
  • Loading branch information
waitingallday committed Oct 16, 2023
1 parent 7c8bc57 commit 76d3233
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 15 deletions.
5 changes: 4 additions & 1 deletion packages/nuxt-ripple/components/TideSidebarContactUs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ const getSocialMediaIconByType = (type: string): string => {
if (type === 'youtube_channel') {
return 'icon-youtube'
}
if (['twitter', 'facebook', 'linkedin', 'instagram'].includes(type)) {
if (type === 'twitter') {
return 'icon-x'
}
if (['x', 'facebook', 'linkedin', 'instagram'].includes(type)) {
return `icon-${type}`
} else {
return 'icon-browser'
Expand Down
13 changes: 12 additions & 1 deletion packages/nuxt-ripple/composables/use-tide-site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,18 @@ export const useTideSite = async (id?: number): Promise<TideSiteData> => {

return data.value
}
return siteData.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
}

export default useTideSite
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const map = (src: TideApiResponse): string[] => {
return []
}

return ['Facebook', 'Twitter', 'LinkedIn']
return ['Facebook', 'X', 'LinkedIn']
}

export const includes = []
1 change: 1 addition & 0 deletions packages/ripple-storybook/.storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { setup, type Preview } from '@storybook/vue3'

// @ts-ignore-next-line: Missing declaration
import { registerRplFormPlugin } from '@dpc-sdp/ripple-ui-forms'
// Note: rebuild ripple-ui-core after generating sprite to update in storybook
// @ts-ignore-next-line: Vue SFC
import { RplIconSprite, RplLink, RplImg } from '@dpc-sdp/ripple-ui-core/vue'
import '@dpc-sdp/ripple-ui-core/style'
Expand Down
3 changes: 3 additions & 0 deletions packages/ripple-ui-core/src/assets/icons/core/icon-x.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/ripple-ui-core/src/assets/icons/sprite.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/ripple-ui-core/src/assets/icons/sprite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ export const SingleTemplate = (args) => ({
icon: 'icon-facebook'
},
{
text: '@twitterhandle',
url: 'https:/t',
icon: 'icon-twitter'
text: '@xhandle',
url: 'https:/x',
icon: 'icon-x'
},
{
text: '@linkedinhandle',
Expand All @@ -71,6 +71,11 @@ export const SingleTemplate = (args) => ({
text: '@instagramhandle',
url: 'https://i',
icon: 'icon-instagram'
},
{
text: '@legacytwitterhandle',
url: 'https:/t',
icon: 'icon-twitter'
}
]
}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import type { IRplListItemArray } from '../list/constants'
import { computed } from 'vue'
import RplList from '../list/RplList.vue'
import {
useRippleEvent,
Expand Down Expand Up @@ -40,6 +41,13 @@ const handleClick = (event) => {
{ global: true }
)
}
// Intercept social links to replace icon-twitter with icon-x
const socialLinks = computed(() =>
props.items.map((i) =>
i.icon === 'icon-twitter' ? { ...i, icon: 'icon-x' } : i
)
)
</script>

<template>
Expand All @@ -59,7 +67,7 @@ const handleClick = (event) => {
</p>
</div>
<RplList
:items="items"
:items="socialLinks"
class="rpl-type-p"
@item-click="handleClick"
></RplList>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ export const RplFooterLinks = [
{
text: 'DFFH Twitter',
url: '#',
icon: 'icon-twitter'
icon: 'icon-x'
},
{
text: 'DH Twitter',
url: '#',
icon: 'icon-twitter'
icon: 'icon-x'
},
{
text: 'DFFH LinkedIn',
Expand Down
4 changes: 2 additions & 2 deletions packages/ripple-ui-core/src/components/icon/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ export const RplIconGroups = {
'icon-instagram',
'icon-linkedin',
'icon-spotify',
'icon-twitter',
'icon-wechat',
'icon-youtube'
'icon-youtube',
'icon-x'
],
standard: [
'icon-accessible',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ const handleClick = () => {
@click.prevent="handleClick"
>
<RplIcon class="rpl-social-share__icon" :name="`icon-${key}`"></RplIcon>
<span>{{ network }}</span>
<span>{{ network === 'X' ? 'X (formerly Twitter)' : network }}</span>
</RplTextLink>
</template>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const RplSocialShareNetworks = {
Facebook: 'https://www.facebook.com/sharer/sharer.php?u=$u&title=$t',
LinkedIn: 'https://www.linkedin.com/shareArticle?url=$u',
Twitter: 'https://twitter.com/intent/tweet?text=$t&url=$u'
X: 'https://twitter.com/intent/tweet?text=$t&url=$u'
}

0 comments on commit 76d3233

Please sign in to comment.