- Created complete documentation in docs/ directory - Added PROJECT_OVERVIEW.md with feature highlights and getting started guide - Added ARCHITECTURE.md with system design and technical details - Added SECURITY.md with comprehensive security implementation guide - Added DEVELOPMENT.md with development workflows and best practices - Added DEPLOYMENT.md with production deployment instructions - Added API.md with complete REST API documentation - Added CONTRIBUTING.md with contribution guidelines - Added CHANGELOG.md with version history and migration notes - Reorganized all documentation files into docs/ directory for better organization - Updated README.md with proper documentation links and quick navigation - Enhanced project structure with professional documentation standards
45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
import React from 'react';
|
|
function isChildSwiperSlide(child) {
|
|
return child.type && child.type.displayName && child.type.displayName.includes('SwiperSlide');
|
|
}
|
|
function processChildren(c) {
|
|
const slides = [];
|
|
React.Children.toArray(c).forEach(child => {
|
|
if (isChildSwiperSlide(child)) {
|
|
slides.push(child);
|
|
} else if (child.props && child.props.children) {
|
|
processChildren(child.props.children).forEach(slide => slides.push(slide));
|
|
}
|
|
});
|
|
return slides;
|
|
}
|
|
function getChildren(c) {
|
|
const slides = [];
|
|
const slots = {
|
|
'container-start': [],
|
|
'container-end': [],
|
|
'wrapper-start': [],
|
|
'wrapper-end': []
|
|
};
|
|
React.Children.toArray(c).forEach(child => {
|
|
if (isChildSwiperSlide(child)) {
|
|
slides.push(child);
|
|
} else if (child.props && child.props.slot && slots[child.props.slot]) {
|
|
slots[child.props.slot].push(child);
|
|
} else if (child.props && child.props.children) {
|
|
const foundSlides = processChildren(child.props.children);
|
|
if (foundSlides.length > 0) {
|
|
foundSlides.forEach(slide => slides.push(slide));
|
|
} else {
|
|
slots['container-end'].push(child);
|
|
}
|
|
} else {
|
|
slots['container-end'].push(child);
|
|
}
|
|
});
|
|
return {
|
|
slides,
|
|
slots
|
|
};
|
|
}
|
|
export { getChildren }; |