/** * Content Components Example * Demonstrates how to use the content components with WordPress data */ import React from 'react'; import { Hero, Section, SectionHeader, SectionContent, SectionGrid, FeaturedImage, ContentRenderer, Breadcrumbs, ContentBlock, RichText, Avatar, ImageGallery, } from './index'; import { Button, Card, CardHeader, CardBody, CardFooter, Grid } from '../ui'; import { Page, Post, Product, getMediaById } from '../../lib/data'; // Example: Hero component with WordPress data export const ExampleHero: React.FC<{ page: Page; }> = ({ page }) => { const featuredMedia = page.featuredImage ? getMediaById(page.featuredImage) : null; return ( ]*>/g, '') : undefined} backgroundImage={featuredMedia?.localPath} backgroundAlt={featuredMedia?.alt || page.title} height="lg" variant="dark" overlay={true} overlayOpacity={0.6} ctaText="Learn More" ctaLink="#content" /> ); }; // Example: Section component for content blocks export const ExampleSection: React.FC<{ title: string; content: string; background?: 'default' | 'light' | 'dark'; }> = ({ title, content, background = 'default' }) => { return (
); }; // Example: Featured content grid export const ExampleContentGrid: React.FC<{ posts: Post[]; }> = ({ posts }) => { return (
{posts.map((post) => { const featuredMedia = post.featuredImage ? getMediaById(post.featuredImage) : null; return ( {featuredMedia && (
)}

{post.title}

{new Date(post.datePublished).toLocaleDateString()}
); })}
); }; // Example: Product showcase export const ExampleProductShowcase: React.FC<{ product: Product; }> = ({ product }) => { const images = product.images.map((img) => ({ src: img, alt: product.name, })); return (
{/* Product Images */}
{product.featuredImage && ( )} {images.length > 1 && (
)}
{/* Product Info */}

{product.name}

{product.regularPrice} {product.currency} {product.salePrice && ( {product.salePrice} {product.currency} )}
{product.categories.length > 0 && (
Categories:
{product.categories.map((cat) => ( {cat.name} ))}
)}
); }; // Example: Breadcrumbs with WordPress page structure export const ExampleBreadcrumbs: React.FC<{ page: Page; ancestors?: Page[]; }> = ({ page, ancestors = [] }) => { const items = [ ...ancestors.map((p) => ({ label: p.title, href: `/${p.locale}${p.path}`, })), { label: page.title, }, ]; return ; }; // Example: Full page layout with all components export const ExamplePageLayout: React.FC<{ page: Page; relatedPosts?: Post[]; }> = ({ page, relatedPosts = [] }) => { const featuredMedia = page.featuredImage ? getMediaById(page.featuredImage) : null; return (
{/* Hero Section */} ]*>/g, '') : undefined} backgroundImage={featuredMedia?.localPath} backgroundAlt={featuredMedia?.alt || page.title} height="md" variant="dark" overlay overlayOpacity={0.5} /> {/* Breadcrumbs */} {/* Main Content */}
{/* Related Posts */} {relatedPosts.length > 0 && (
{relatedPosts.map((post) => (

{post.title}

))}
)} {/* CTA Section */}

Ready to Get Started?

Contact us today for more information about our products and services.

); }; // Example: Blog post layout export const ExampleBlogPost: React.FC<{ post: Post; author?: { name: string; avatar?: string; }; }> = ({ post, author }) => { const featuredMedia = post.featuredImage ? getMediaById(post.featuredImage) : null; return (
{/* Header */}

{post.title}

{author && (
{author.avatar && } {author.name}
)}
{/* Featured Image */} {featuredMedia && (
)} {/* Content */}
); }; // Example: Product category grid export const ExampleProductGrid: React.FC<{ products: Product[]; category?: string; }> = ({ products, category }) => { return (
{products.map((product) => { const image = product.featuredImage || product.images[0]; return ( {image && (
)}

{product.name}

{product.regularPrice} {product.currency}
); })}
); }; export default { ExampleHero, ExampleSection, ExampleContentGrid, ExampleProductShowcase, ExampleBreadcrumbs, ExamplePageLayout, ExampleBlogPost, ExampleProductGrid, };