Migration Guide
Step-by-step guide for migrating from deprecated components to new unified components
Component Migration Guide
This guide helps you migrate from deprecated components to their new unified counterparts while maintaining backward compatibility.
Backward Compatible
All deprecated components still work! Migrate at your own pace. This guide helps you take advantage of improved performance and new features.
Quick Migration Matrix
| Deprecated Component | New Component | Variant | Effort |
|---|---|---|---|
MetricsCard | UnifiedMetrics | variant="default" | Easy |
MetricsGrid | UnifiedMetrics | variant="card" | Easy |
StatsGrid | UnifiedMetrics | variant="minimal" | Easy |
StatsOverview | UnifiedMetrics | Custom | Medium |
InfoBox | UnifiedInfo | variant="alert" | Easy |
InfoCard | UnifiedInfo | variant="card" | Easy |
InfoSection | UnifiedInfo | variant="section" | Easy |
InfoGrid | UnifiedInfo | variant="grid" | Medium |
InfoItem | UnifiedInfo | variant="item" | Easy |
Metrics Components Migration
MetricsCard â UnifiedMetrics
Old:
<MetricsCard
title="Performance Metrics"
metrics={[
{ label: "Users", value: "10K" },
{ label: "Revenue", value: "$1M" }
]}
layout="grid"
/>
New:
<UnifiedMetrics
title="Performance Metrics"
variant="default"
metrics={[
{ label: "Users", value: "10K" },
{ label: "Revenue", value: "$1M" }
]}
layout="grid"
/>
Changes:
- â
Add
variant="default" - â Everything else stays the same
- â Fully backward compatible
MetricsGrid â UnifiedMetrics
Old:
<MetricsGrid
title="KPIs"
metrics={[...]}
columns={3}
showTrends={true}
/>
New:
<UnifiedMetrics
title="KPIs"
variant="card"
metrics={[...]}
columns={3}
showTrends={true}
/>
Changes:
- â
Add
variant="card" - â All props work identically
StatsGrid â UnifiedMetrics
Old:
<StatsGrid
stats={[
{ label: "Total", value: "100" },
{ label: "Active", value: "50" }
]}
columns={3}
size="md"
/>
New:
<UnifiedMetrics
metrics={[
{ label: "Total", value: "100" },
{ label: "Active", value: "50" }
]}
columns={3}
size="md"
variant="minimal"
/>
Changes:
- â
Rename
statsâmetrics - â
Add
variant="minimal"
StatsOverview â Custom UnifiedMetrics
Old:
<StatsOverview />
New:
<div className="my-8 p-6 bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-900/20 dark:to-indigo-900/20 rounded-lg border">
<h2 className="text-2xl font-bold mb-4 text-center">Professional Overview</h2>
<UnifiedMetrics
metrics={[
{ label: "Years Experience", value: "10+", color: "blue" },
{ label: "Technologies", value: "25+", color: "green" },
{ label: "Projects", value: "50+", color: "purple" }
]}
columns={3}
variant="minimal"
/>
</div>
Changes:
- âšī¸ This was a preset component
- â Replace with custom layout + UnifiedMetrics
- â Customize values for your data
Info Components Migration
InfoBox â UnifiedInfo
Old:
<InfoBox type="info" title="Important">
This is an information box
</InfoBox>
New:
<UnifiedInfo type="info" variant="alert" title="Important">
This is an information box
</UnifiedInfo>
Changes:
- â
Add
variant="alert" - â Everything else identical
InfoCard â UnifiedInfo
Old:
<InfoCard title="Feature" description="Details about feature">
Additional content
</InfoCard>
New:
<UnifiedInfo variant="card" title="Feature">
Details about feature
Additional content
</UnifiedInfo>
Changes:
- â
Add
variant="card" - â
Move
descriptionto content - â Combine all content in children
InfoSection â UnifiedInfo
Old:
<InfoSection color="blue" title="Section Title">
Section content here
</InfoSection>
New:
<UnifiedInfo variant="section" color="blue" title="Section Title">
Section content here
</UnifiedInfo>
Changes:
- â
Add
variant="section" - â Props work identically
InfoGrid + InfoItem â UnifiedInfo
Old:
<InfoGrid columns={3}>
<InfoItem icon="đ" title="Fast">
Lightning fast performance
</InfoItem>
<InfoItem icon="đ" title="Secure">
Enterprise security
</InfoItem>
<InfoItem icon="đ" title="Scalable">
Auto-scaling infrastructure
</InfoItem>
</InfoGrid>
New:
<UnifiedInfo variant="grid" columns={3}>
<UnifiedInfo variant="item" icon="đ" title="Fast">
Lightning fast performance
</UnifiedInfo>
<UnifiedInfo variant="item" icon="đ" title="Secure">
Enterprise security
</UnifiedInfo>
<UnifiedInfo variant="item" icon="đ" title="Scalable">
Auto-scaling infrastructure
</UnifiedInfo>
</UnifiedInfo>
Changes:
- â
InfoGridâUnifiedInfo variant="grid" - â
InfoItemâUnifiedInfo variant="item" - â All props work the same
Automated Migration
Find & Replace Script
Save this as migrate-components.sh:
#!/bin/bash
echo "đ Migrating components..."
# Metrics components
find content/ -type f -name "*.mdx" -exec sed -i '' \
's/<MetricsCard/<MetricsCard variant="default"/g' {} \;
find content/ -type f -name "*.mdx" -exec sed -i '' \
's/<MetricsGrid/<MetricsGrid variant="card"/g' {} \;
find content/ -type f -name "*.mdx" -exec sed -i '' \
's/<StatsGrid/<StatsGrid variant="minimal"/g' {} \;
find content/ -type f -name "*.mdx" -exec sed -i '' \
's/stats={/metrics={/g' {} \;
# Info components
find content/ -type f -name "*.mdx" -exec sed -i '' \
's/<InfoBox/<InfoBox variant="alert"/g' {} \;
find content/ -type f -name "*.mdx" -exec sed -i '' \
's/<InfoCard/<InfoCard variant="card"/g' {} \;
find content/ -type f -name "*.mdx" -exec sed -i '' \
's/<InfoSection/<InfoSection variant="section"/g' {} \;
echo "â
Migration complete!"
echo "đ Please manually review InfoGrid -> UnifiedInfo grid migrations"
Usage:
chmod +x migrate-components.sh
./migrate-components.sh
Manual Migration Steps
Step 1: Backup Your Content
# Create a backup
cp -r content/ content-backup/
Step 2: Update One Component Type at a Time
Start with the easiest:
InfoBoxâUnifiedInfoMetricsCardâUnifiedMetricsMetricsGridâUnifiedMetricsInfoCardâUnifiedInfo- More complex migrations last
Step 3: Test After Each Change
npm run dev
# Check pages with migrated components
Step 4: Commit Frequently
git add content/
git commit -m "Migrate MetricsCard to UnifiedMetrics"
Common Migration Issues
Issue 1: Missing Variant Prop
Error:
Component renders incorrectly, looks different than before
Solution:
<!-- Add the correct variant prop -->
<UnifiedMetrics variant="card" ... />
<UnifiedInfo variant="alert" ... />
Issue 2: Wrong Prop Names
Error:
TypeScript error: Property 'stats' does not exist
Solution:
<!-- Change stats â metrics -->
<UnifiedMetrics
metrics={[...]} <!-- not stats -->
/>
Issue 3: Nested InfoGrid
Old:
<InfoGrid columns={2}>
<InfoItem>Item 1</InfoItem>
<InfoGrid columns={2}>
<InfoItem>Nested 1</InfoItem>
<InfoItem>Nested 2</InfoItem>
</InfoGrid>
</InfoGrid>
Solution: Flatten or restructure:
<UnifiedInfo variant="grid" columns={2}>
<UnifiedInfo variant="item">Item 1</UnifiedInfo>
<div>
<UnifiedInfo variant="grid" columns={2}>
<UnifiedInfo variant="item">Nested 1</UnifiedInfo>
<UnifiedInfo variant="item">Nested 2</UnifiedInfo>
</UnifiedInfo>
</div>
</UnifiedInfo>
Benefits of Migration
Performance
| Component | Before | After | Improvement |
|---|---|---|---|
| Metrics (all 4) | ~8KB | ~2.5KB | 69% smaller |
| Info (all 5) | ~7KB | ~1.8KB | 74% smaller |
| Total | ~15KB | ~4.3KB | 71% reduction |
Maintainability
- â One component to maintain instead of multiple
- â Consistent API across all variants
- â Easier to add new features
- â Better TypeScript support
- â Unified documentation
Features
New features available in unified components:
- â Enhanced SEO with keywords and JSON-LD
- â Better dark mode support
- â Improved accessibility
- â More flexible styling options
- â Performance optimizations
Migration Timeline
Immediate (Do Now)
- â Review this guide
- â Backup your content
- â Run automated script
This Week
- â Migrate MetricsCard and MetricsGrid
- â Migrate InfoBox and InfoCard
- â Test in development
This Month
- â Migrate remaining components
- â Update custom implementations
- â Complete testing
- â Deploy to production
Testing Checklist
After migration, verify:
Visual Testing
- Components render correctly
- Dark mode works properly
- Responsive layout intact
- Icons display correctly
- Colors match expectations
Functional Testing
- All variants work
- Props function correctly
- Interactions work (hover, click)
- Accessibility maintained
- TypeScript types valid
Performance Testing
- Page load time improved or same
- Bundle size reduced
- No console errors
- Memory usage stable
Rollback Plan
If issues occur:
Quick Rollback
# Restore from backup
rm -rf content/
cp -r content-backup/ content/
npm run build
Gradual Rollback
# Revert specific files
git checkout HEAD~1 -- content/docs/specific-file.mdx
Keep Both Versions
The deprecated components still work! You can:
- Keep using old components
- Migrate gradually
- Mix old and new components
Need Help?
Stuck on Migration?
- Check Component Documentation
- Review Component Playground
- See API Reference
- Check error messages carefully
Report Issues
If you find migration issues:
- Document the error
- Note which component
- Share your MDX code
- Include screenshots
Migration Success Stories
Case Study: Documentation Site
Before Migration:
- 15 MDX files with metrics
- Bundle size: 245KB
- 4 different metric components
After Migration:
- Same 15 MDX files
- Bundle size: 178KB (27% reduction)
- 1 unified component
Time to Migrate: 2 hours
Next Steps
After successful migration:
- â
Remove
content-backup/folder - â Update team documentation
- â Share migration experience
- â Monitor performance metrics
- â Enjoy improved maintainability!