6.5 KiB
Project Pages Guide
Created: 2025-01-27
Last Modified: 2025-01-27
Last Modified Summary: Initial documentation for modular project page system
Overview
The RevampIT project pages use a modular, DRY (Don't Repeat Yourself) architecture that ensures consistency, maintainability, and easy extension. All project pages share the same underlying components and design patterns.
Architecture
Component Structure
src/components/projects/
├── types.ts # TypeScript type definitions
├── ProjectHero.tsx # Hero section component
├── ProjectSection.tsx # Reusable section component
├── ProjectCallToAction.tsx # CTA section component
├── ProjectPage.tsx # Main page orchestrator
└── index.ts # Component exports
Key Principles
- DRY: No code duplication across project pages
- Modular: Each component has a single responsibility
- Config-Driven: Pages are defined by configuration objects
- Type-Safe: Full TypeScript type safety
- Consistent: All pages share the same design patterns
Usage
Basic Project Page
import { Metadata } from 'next'
import { ProjectPage, generateProjectMetadata } from '@/components/projects'
import { ProjectPageConfig } from '@/components/projects/types'
const projectConfig: ProjectPageConfig = {
hero: {
title: 'Project Name',
description: 'Project description',
ctas: [
{
text: 'Primary Action',
href: '/action',
variant: 'primary'
},
{
text: 'Secondary Action',
href: '/secondary',
variant: 'outline'
}
]
},
sections: [
{
title: 'Section Title',
description: 'Section description',
backgroundColor: 'white',
layout: 'grid-3',
cards: [
{
title: 'Card Title',
description: 'Card description',
features: ['Feature 1', 'Feature 2']
}
]
}
],
metadata: {
title: 'Project Title | RevampIT',
description: 'Project meta description'
}
}
export const metadata: Metadata = generateProjectMetadata(projectConfig)
export default function ProjectPage() {
return <ProjectPage config={projectConfig} />
}
Component Reference
ProjectHero
Displays the hero section with title, description, and CTAs.
Props:
hero: ProjectHeroTypetitle: stringdescription: stringbackgroundColor?: string (for custom hero colors)ctas?: ProjectCTA[]
CTA Variants:
primary: White button with green textoutline: Transparent button with white bordersecondary: Default button styling
ProjectSection
Reusable section component with flexible layouts.
Props:
section: ProjectSectionTypetitle: stringdescription?: stringcards?: ProjectCard[]backgroundColor?: 'white' | 'gray' | 'primary'layout?: 'grid-2' | 'grid-3' | 'grid-4' | 'single'
Layout Options:
grid-2: 2 columns on medium+ screensgrid-3: 3 columns on medium+ screensgrid-4: 4 columns on medium+ screenssingle: Single column
ProjectCallToAction
Standardized CTA section for getting involved.
Props:
title: stringsubtitle?: stringactions: ProjectCard[]backgroundColor?: 'white' | 'gray' | 'primary'
Design Patterns
Background Colors
Sections alternate between white and gray backgrounds for visual hierarchy:
sections: [
{ backgroundColor: 'white' }, // Section 1
{ backgroundColor: 'gray' }, // Section 2
{ backgroundColor: 'white' } // Section 3
]
Card Layouts
Cards adapt to content density:
- Grid 3: For feature highlights (3 items)
- Grid 2: For detailed cards (2 items)
- Grid 4: For simple icon lists (4 items)
Call-to-Action Placement
CTAs appear in two places:
- Hero CTAs: Primary actions in the hero section
- Bottom CTA: Full involvement section at the bottom
Examples
Compirat Page
Located at src/app/projects/compirat/page.tsx
Features:
- Hero with two CTAs
- Four sections with different layouts
- Bottom CTA section with three action cards
Linuxola Page
Located at src/app/projects/linuxola/page.tsx
Features:
- Mission and impact cards
- Equipment needs section
- Social sharing integration
Migration Guide
Converting Custom Pages
To migrate an existing custom project page:
- Extract configuration: Convert hardcoded content to config object
- Use components: Replace custom JSX with ProjectPage components
- Add CTA: Include ProjectCallToAction for involvement section
- Test: Verify visual consistency
Before (Custom Implementation)
export default function CustomPage() {
return (
<main>
<HeroBanner title="Project" description="Description">
<Button>Action</Button>
</HeroBanner>
<section className="py-20 bg-white">
{/* Custom section code */}
</section>
</main>
)
}
After (Modular Implementation)
const config: ProjectPageConfig = {
hero: { title: 'Project', description: 'Description', ctas: [...] },
sections: [{ title: 'Section', ... }]
}
export default function ModularPage() {
return <ProjectPage config={config} />
}
Benefits
Maintainability
- ✅ Single source of truth for each component
- ✅ Easy to update design across all pages
- ✅ Consistent behavior and styling
Developer Experience
- ✅ Less code to write
- ✅ Type-safe configurations
- ✅ Clear component hierarchy
Performance
- ✅ Smaller bundle size (shared components)
- ✅ Optimized rendering
Consistency
- ✅ All pages look professional
- ✅ Same UX patterns
- ✅ No design inconsistencies
Best Practices
- Use configurations: Define pages with config objects, not custom JSX
- Follow layouts: Choose appropriate grid layouts for content density
- Alternate backgrounds: Use white/gray alternation for visual flow
- Keep CTAs focused: Maximum 2-3 CTAs in hero section
- Add CTA section: Always include ProjectCallToAction at bottom
Future Enhancements
- Add animation variants
- Support for custom section components
- Theme customization per project
- Analytics integration
- SEO optimization helpers
See Also
SERVICE_PAGES_GUIDE.md- Similar guide for service pagesARCHITECTURE.md- Overall system architecture/src/components/projects/- Component source code