14 KiB
Shared Component Library
This directory contains reusable UI components, layouts, and templates that can be shared across multiple frontend applications in the IGNY8 platform.
Overview
The shared component library provides:
- Blocks: Reusable content blocks (hero sections, feature grids, stats panels)
- Layouts: Page layout wrappers (default, minimal)
- Templates: Complete page templates (marketing, landing pages)
These components are designed to be framework-agnostic where possible, but currently implemented in React/TypeScript.
Directory Structure
shared/
├── blocks/ # Content blocks (12 total)
│ ├── HeroBlock.tsx
│ ├── FeatureGridBlock.tsx
│ ├── StatsPanel.tsx
│ ├── ServicesBlock.tsx
│ ├── ProductsBlock.tsx
│ ├── TestimonialsBlock.tsx
│ ├── ContactFormBlock.tsx
│ ├── CTABlock.tsx
│ ├── ImageGalleryBlock.tsx
│ ├── VideoBlock.tsx
│ ├── TextBlock.tsx
│ ├── QuoteBlock.tsx
│ ├── blocks.css
│ └── index.ts
├── layouts/ # Page layouts (7 total)
│ ├── DefaultLayout.tsx
│ ├── MinimalLayout.tsx
│ ├── MagazineLayout.tsx
│ ├── EcommerceLayout.tsx
│ ├── PortfolioLayout.tsx
│ ├── BlogLayout.tsx
│ ├── CorporateLayout.tsx
│ ├── layouts.css
│ └── index.ts
├── templates/ # Full page templates (6 total)
│ ├── MarketingTemplate.tsx
│ ├── LandingTemplate.tsx
│ ├── BlogTemplate.tsx
│ ├── BusinessTemplate.tsx
│ ├── PortfolioTemplate.tsx
│ ├── EcommerceTemplate.tsx
│ └── index.ts
├── index.ts # Barrel exports
└── README.md # This file
Usage
In Site Builder (site-builder/)
The Site Builder application imports shared components via the @shared alias configured in vite.config.ts:
import { HeroBlock, MarketingTemplate } from '@shared';
In Main Frontend (frontend/)
Import directly from the shared directory:
import { HeroBlock } from '@/components/shared/blocks';
import { DefaultLayout } from '@/components/shared/layouts';
Components
Blocks
HeroBlock
Hero section component for landing pages and marketing sites.
Props:
heading: string- Main headlinesubheading?: string- Supporting textctaText?: string- Call-to-action button textctaLink?: string- Call-to-action link URLimageUrl?: string- Hero image URLvariant?: 'default' | 'centered' | 'split'- Layout variant
Example:
<HeroBlock
heading="Build Your Site with AI"
subheading="Create professional marketing sites in minutes"
ctaText="Get Started"
ctaLink="/signup"
/>
FeatureGridBlock
Grid layout for displaying features or benefits.
Props:
title?: string- Section titlefeatures: Array<{ title: string; description: string; icon?: ReactNode }>- Feature itemscolumns?: 2 | 3 | 4- Number of columns
Example:
<FeatureGridBlock
title="Key Features"
features={[
{ title: 'AI-Powered', description: 'Generate content automatically' },
{ title: 'Fast Setup', description: 'Launch in minutes' },
]}
columns={3}
/>
StatsPanel
Statistics display component.
Props:
stats: Array<{ label: string; value: string | number }>- Statistics to displayvariant?: 'default' | 'compact'- Display variant
Example:
<StatsPanel
stats={[
{ label: 'Sites Created', value: '1,234' },
{ label: 'Active Users', value: '567' },
]}
/>
ServicesBlock
Display services or offerings in a grid layout.
Props:
title?: string- Section titlesubtitle?: string- Section subtitleservices: Array<{ title: string; description: string; icon?: ReactNode; imageUrl?: string }>- Service itemscolumns?: 2 | 3 | 4- Number of columnsvariant?: 'default' | 'card' | 'minimal'- Display variant
ProductsBlock
Display products in a grid or list layout.
Props:
title?: string- Section titlesubtitle?: string- Section subtitleproducts: Array<{ name: string; description?: string; price?: string; imageUrl?: string; ctaLabel?: string }>- Product itemscolumns?: 2 | 3 | 4- Number of columnsvariant?: 'grid' | 'list' | 'carousel'- Display variant
TestimonialsBlock
Display customer testimonials with ratings and author info.
Props:
title?: string- Section titlesubtitle?: string- Section subtitletestimonials: Array<{ quote: string; author: string; role?: string; company?: string; avatarUrl?: string; rating?: number }>- Testimonial itemscolumns?: 1 | 2 | 3- Number of columnsvariant?: 'default' | 'card' | 'minimal'- Display variant
ContactFormBlock
Contact form with customizable fields.
Props:
title?: string- Form titlesubtitle?: string- Form subtitlefields?: Array<{ name: string; label: string; type: 'text' | 'email' | 'tel' | 'textarea'; required?: boolean; placeholder?: string }>- Form fieldssubmitLabel?: string- Submit button labelonSubmit?: (data: Record<string, string>) => void- Submit handler
CTABlock
Call-to-action section with primary and secondary actions.
Props:
title: string- CTA titlesubtitle?: string- CTA subtitleprimaryCtaLabel?: string- Primary button labelprimaryCtaLink?: string- Primary button linkonPrimaryCtaClick?: () => void- Primary button click handlersecondaryCtaLabel?: string- Secondary button labelsecondaryCtaLink?: string- Secondary button linkonSecondaryCtaClick?: () => void- Secondary button click handlerbackgroundImage?: string- Background image URLvariant?: 'default' | 'centered' | 'split'- Layout variant
ImageGalleryBlock
Image gallery with grid, masonry, or carousel layout.
Props:
title?: string- Gallery titlesubtitle?: string- Gallery subtitleimages: Array<{ url: string; alt?: string; caption?: string; thumbnailUrl?: string }>- Image itemscolumns?: 2 | 3 | 4- Number of columnsvariant?: 'grid' | 'masonry' | 'carousel'- Display variantlightbox?: boolean- Enable lightbox on click
VideoBlock
Video player component supporting both video URLs and embed codes.
Props:
title?: string- Video titlesubtitle?: string- Video subtitlevideoUrl?: string- Video file URLembedCode?: string- HTML embed code (e.g., YouTube iframe)thumbnailUrl?: string- Video thumbnail/posterautoplay?: boolean- Autoplay videocontrols?: boolean- Show video controlsloop?: boolean- Loop videomuted?: boolean- Mute videovariant?: 'default' | 'fullwidth' | 'centered'- Layout variant
TextBlock
Simple text content block with customizable alignment and width.
Props:
title?: string- Block titlecontent: string | ReactNode- Text content (HTML string or React nodes)align?: 'left' | 'center' | 'right' | 'justify'- Text alignmentvariant?: 'default' | 'narrow' | 'wide' | 'fullwidth'- Width variant
QuoteBlock
Quote/testimonial block with author information.
Props:
quote: string- Quote textauthor?: string- Author namerole?: string- Author rolecompany?: string- Author companyavatarUrl?: string- Author avatar imagevariant?: 'default' | 'large' | 'minimal' | 'card'- Display variantalign?: 'left' | 'center' | 'right'- Text alignment
Layouts
DefaultLayout
Standard page layout with header, main content area, and footer.
Props:
children: ReactNode- Page contentheader?: ReactNode- Custom header componentfooter?: ReactNode- Custom footer componentsidebar?: ReactNode- Optional sidebar
Example:
<DefaultLayout>
<YourPageContent />
</DefaultLayout>
MinimalLayout
Minimal layout for focused content pages.
Props:
children: ReactNode- Page contentbackground?: 'light' | 'dark'- Background color
Example:
<MinimalLayout background="light">
<ArticleContent />
</MinimalLayout>
MagazineLayout
Magazine-style layout with featured section and sidebar.
Props:
header?: ReactNode- Page headerfeatured?: ReactNode- Featured content sectionsidebar?: ReactNode- Sidebar contentmainContent: ReactNode- Main content areafooter?: ReactNode- Page footer
EcommerceLayout
E-commerce layout with navigation and product sidebar.
Props:
header?: ReactNode- Page headernavigation?: ReactNode- Navigation menusidebar?: ReactNode- Sidebar (filters, categories)mainContent: ReactNode- Main content (products)footer?: ReactNode- Page footer
PortfolioLayout
Portfolio layout optimized for showcasing work.
Props:
header?: ReactNode- Page headermainContent: ReactNode- Main content (gallery, projects)footer?: ReactNode- Page footerfullWidth?: boolean- Full-width layout option
BlogLayout
Blog layout with optional sidebar (left or right).
Props:
header?: ReactNode- Page headersidebar?: ReactNode- Sidebar contentmainContent: ReactNode- Main content (blog posts)footer?: ReactNode- Page footersidebarPosition?: 'left' | 'right'- Sidebar position
CorporateLayout
Corporate/business layout with navigation and structured sections.
Props:
header?: ReactNode- Page headernavigation?: ReactNode- Navigation menumainContent: ReactNode- Main contentfooter?: ReactNode- Page footersidebar?: ReactNode- Optional sidebar
Templates
MarketingTemplate
Complete marketing page template with hero, features, and CTA sections.
Props:
hero: HeroBlockProps- Hero section configurationfeatures?: FeatureGridBlockProps- Features sectionstats?: StatsPanelProps- Statistics sectioncta?: { text: string; link: string }- Call-to-action
Example:
<MarketingTemplate
hero={{
heading: "Welcome to IGNY8",
subheading: "AI-powered content generation",
ctaText: "Start Free Trial",
ctaLink: "/signup"
}}
features={{
features: [
{ title: 'AI Writer', description: 'Generate content automatically' },
{ title: 'Site Builder', description: 'Create sites in minutes' },
]
}}
/>
LandingTemplate
Landing page template optimized for conversions.
Props:
- Similar to
MarketingTemplatewith additional conversion-focused sections
BlogTemplate
Blog page template with posts and sidebar.
Props:
header?: ReactNode- Page headersidebar?: ReactNode- Sidebar contentposts: ReactNode- Blog posts contentfooter?: ReactNode- Page footersidebarPosition?: 'left' | 'right'- Sidebar position
BusinessTemplate
Business/corporate page template.
Props:
header?: ReactNode- Page headernavigation?: ReactNode- Navigation menuhero?: ReactNode- Hero sectionfeatures?: ReactNode- Features sectionservices?: ReactNode- Services sectiontestimonials?: ReactNode- Testimonials sectioncta?: ReactNode- Call-to-action sectionfooter?: ReactNode- Page footer
PortfolioTemplate
Portfolio showcase template.
Props:
header?: ReactNode- Page headergallery?: ReactNode- Portfolio galleryabout?: ReactNode- About sectioncontact?: ReactNode- Contact sectionfooter?: ReactNode- Page footerfullWidth?: boolean- Full-width layout
EcommerceTemplate
E-commerce store template.
Props:
header?: ReactNode- Page headernavigation?: ReactNode- Navigation menusidebar?: ReactNode- Sidebar (filters)products?: ReactNode- Products gridfeatured?: ReactNode- Featured productsfooter?: ReactNode- Page footer
Styling
Components use CSS modules and shared CSS files:
blocks/blocks.css- Block component styleslayouts/layouts.css- Layout component styles
Styles are scoped to prevent conflicts. When using in different applications, ensure CSS is imported:
import '@shared/blocks/blocks.css';
import '@shared/layouts/layouts.css';
TypeScript Types
All components are fully typed. Import types from the component files:
import type { HeroBlockProps } from '@shared/blocks/HeroBlock';
Best Practices
-
Composition over Configuration: Prefer composing blocks into templates rather than creating monolithic components.
-
Props Validation: All components validate required props. Use TypeScript for compile-time safety.
-
Accessibility: Components follow WCAG guidelines. Include ARIA labels where appropriate.
-
Responsive Design: All components are mobile-first and responsive.
-
Performance: Use React.memo for expensive components, lazy loading for templates.
Contributing
When adding new shared components:
- Create the component in the appropriate directory (
blocks/,layouts/, ortemplates/) - Export from the directory's
index.ts - Add to the main
shared/index.tsbarrel export - Document props and usage in this README
- Add TypeScript types
- Include CSS in the appropriate stylesheet
- Write tests (if applicable)
Testing
Shared components should be tested in the consuming applications. The Site Builder includes tests for components used in the preview canvas.
Future Enhancements
- Storybook integration for component documentation
- Design tokens/theming system
- Animation utilities
- Form components library
- Icon library integration