Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
20 changes: 18 additions & 2 deletions apps/addon-catalog/components/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,27 @@ interface PreviewProps {

export const Preview = ({ element, orientation, type }: PreviewProps) => {
const isRecipe = type === 'recipe';
const Comp = isRecipe ? 'a' : Link;
// Determine if the link should be local or external
let href = '';
let isExternal = false;
if (isRecipe) {
href = `/recipes/${element.name ?? ''}`;
} else {
// For addons, check if the name starts with '@' (scoped package) or contains a slash
// If so, assume it's not handled locally and link to the external Storybook site
if (element.name && (element.name.startsWith('@') || element.name.includes('/'))) {
href = `https://storybook.js.org/addons/${element.name}`;
isExternal = true;
} else {
href = `/${element.name ?? ''}`;
}
}
const Comp = isExternal ? 'a' : Link;

return (
<Comp
href={`${isRecipe ? '/recipes' : ''}/${element.name ?? ''}`}
href={href}
{...(isExternal ? { target: '_blank', rel: 'noopener noreferrer' } : {})}
className={cn(
'flex justify-between rounded border border-zinc-300 p-6 transition-all duration-200 ease-in-out hover:-translate-y-0.5 hover:border-blue-500 dark:border-slate-800 dark:hover:border-blue-500',
orientation === 'horizontal'
Expand Down
12 changes: 12 additions & 0 deletions apps/frontpage/app/showcase/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import dynamic from 'next/dynamic';

// Dynamically import HomeWrapper from addon-catalog for SSR compatibility
const HomeWrapper = dynamic(
() => import('../../../addon-catalog/components/home-wrapper').then(mod => mod.HomeWrapper),
{ ssr: false }
);

export default function ShowcasePage() {
// The HomeWrapper will handle search and display logic
return <HomeWrapper />;
}