Skip to content

Commit

Permalink
Merge pull request #1175 from dpc-sdp/fix/social-networks-fallback
Browse files Browse the repository at this point in the history
fix(@dpc-sdp/nuxt-ripple): 🐛 fallback to default if unspecified
  • Loading branch information
dylankelly authored May 21, 2024
2 parents 8acf85a + 70b36b9 commit 0394d9a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
14 changes: 14 additions & 0 deletions examples/nuxt-app/pages/_layout.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<template>
<TideLandingPage :site="site as any" :page="page as any">
<template #sidebar>
<TideSidebarSocialShare :page-title="page.title" />
</template>
</TideLandingPage>
</template>

<script setup lang="ts">
import page from '../test/fixtures/case/accordions-inpage-nav.json'
import { useTideSite } from '#imports'
const site = await useTideSite()
</script>
9 changes: 5 additions & 4 deletions packages/nuxt-ripple/components/TideSidebarSocialShare.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ const url = computed(() => `${$app_origin}${route?.path}`)
const { socialShare: flags }: IRplFeatureFlags = inject('featureFlags', {})
const activeNetworks = computed(() => {
let items = props.networks.filter(
(item: any) => flags?.[item as keyof TideSocialShare] ?? true
)
const items =
props.networks?.filter(
(item: any) => flags?.[item as keyof TideSocialShare] ?? true
) || []
if (flags?.WhatsApp) {
items.push('WhatsApp')
}
return items
return items.length > 0 ? items : undefined
})
const parseText = (text: string): string => {
Expand Down

0 comments on commit 0394d9a

Please sign in to comment.