Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/components/Package/Playgrounds.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const providerIcons: Record<string, string> = {
'solid-playground': 'i-simple-icons:solid',
'svelte-playground': 'i-simple-icons:svelte',
'tailwind-playground': 'i-simple-icons:tailwindcss',
'storybook': 'i-simple-icons:storybook',
}

// Map provider id to color class
Expand All @@ -37,6 +38,7 @@ const providerColors: Record<string, string> = {
'solid-playground': 'text-provider-solid',
'svelte-playground': 'text-provider-svelte',
'tailwind-playground': 'text-provider-tailwind',
'storybook': 'text-provider-storybook',
}

function getIcon(provider: string): string {
Expand Down
25 changes: 21 additions & 4 deletions app/pages/package/[[org]]/[name].vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,26 @@ const { data: readmeData } = useLazyFetch<ReadmeResponse>(
{ default: () => ({ html: '', mdExists: false, playgroundLinks: [], toc: [] }) },
)

const { data: packageJson } = useLazyFetch<{ storybook?: { title: string; url: string } }>(() => {
const version = requestedVersion.value ?? 'latest'
return `https://cdn.jsdelivr.net/npm/${packageName.value}@${version}/package.json`
})

const playgroundLinks = computed(() => [
...readmeData.value.playgroundLinks,
// Libraries with a storybook field in package.json contain a link to their deployed playground
...(packageJson.value?.storybook

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
...(packageJson.value?.storybook
...(packageJson.value?.storybook?.url

? [
{
url: packageJson.value.storybook.url,
provider: 'storybook',
providerName: 'Storybook',
label: 'Storybook',
},
]
: []),
])
Comment thread
coderabbitai[bot] marked this conversation as resolved.

const {
data: readmeMarkdownData,
status: readmeMarkdownStatus,
Expand Down Expand Up @@ -1387,10 +1407,7 @@ const showSkeleton = shallowRef(false)
/>

<!-- Playground links -->
<PackagePlaygrounds
v-if="readmeData?.playgroundLinks?.length"
:links="readmeData.playgroundLinks"
/>
<PackagePlaygrounds v-if="playgroundLinks.length" :links="playgroundLinks" />

<PackageCompatibility :engines="displayVersion?.engines" />

Expand Down
1 change: 1 addition & 0 deletions uno.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export default defineConfig({
solid: '#2C4F7C',
svelte: '#FF3E00',
tailwind: '#06B6D4',
storybook: '#FF4785',
},
},
animation: {
Expand Down
Loading