/* istanbul ignore file */
/**
* Example Component
* Container for live component demonstrations with optional code display
* This file is excluded from coverage as it's a demo/showcase component
*/
'use client';
import { Code2, Eye } from 'lucide-react';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { Badge } from '@/components/ui/badge';
import { CodeSnippet } from './CodeSnippet';
import { cn } from '@/lib/utils';
interface ExampleProps {
title?: string;
description?: string;
children: React.ReactNode;
code?: string;
variant?: 'default' | 'compact';
className?: string;
centered?: boolean;
tags?: string[];
}
/**
* Example - Live component demonstration container
*
* @example
* Click me`}
* >
*
*
*/
export function Example({
title,
description,
children,
code,
variant = 'default',
className,
centered = false,
tags,
}: ExampleProps) {
// Compact variant - no card wrapper
if (variant === 'compact') {
return (
{/* Header */}
{(title || description || tags) && (
{title &&
{title}
}
{tags && (
{tags.map((tag) => (
{tag}
))}
)}
{description &&
{description}
}
)}
{/* Demo */}
{children}
{/* Code */}
{code &&
}
);
}
// Default variant - full card with tabs
return (
{title &&
{title}}
{tags && (
{tags.map((tag) => (
{tag}
))}
)}
{description &&
{description}}
{code ? (
Preview
Code
{children}
) : (
{children}
)}
);
}
/**
* ExampleGrid - Grid layout for multiple examples
*
* @example
*
* ...
* ...
*
*/
export function ExampleGrid({
children,
cols = 2,
className,
}: {
children: React.ReactNode;
cols?: 1 | 2 | 3;
className?: string;
}) {
const colsClass = {
1: 'grid-cols-1',
2: 'grid-cols-1 lg:grid-cols-2',
3: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3',
}[cols];
return {children}
;
}
/**
* ExampleSection - Section wrapper with title
*
* @example
*
* ...
*
*/
export function ExampleSection({
title,
description,
children,
id,
className,
}: {
title: string;
description?: string;
children: React.ReactNode;
id?: string;
className?: string;
}) {
return (
{title}
{description &&
{description}
}
{children}
);
}