1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,50 +0,0 @@ |
1 |
-import React from 'react'; |
|
2 |
- |
|
3 |
-function processChildren(c) { |
|
4 |
- var slides = []; |
|
5 |
- React.Children.toArray(c).forEach(function (child) { |
|
6 |
- if (child.type && child.type.displayName === 'SwiperSlide') { |
|
7 |
- slides.push(child); |
|
8 |
- } else if (child.props && child.props.children) { |
|
9 |
- processChildren(child.props.children).forEach(function (slide) { |
|
10 |
- return slides.push(slide); |
|
11 |
- }); |
|
12 |
- } |
|
13 |
- }); |
|
14 |
- return slides; |
|
15 |
-} |
|
16 |
- |
|
17 |
-function getChildren(c) { |
|
18 |
- var slides = []; |
|
19 |
- var slots = { |
|
20 |
- 'container-start': [], |
|
21 |
- 'container-end': [], |
|
22 |
- 'wrapper-start': [], |
|
23 |
- 'wrapper-end': [] |
|
24 |
- }; |
|
25 |
- React.Children.toArray(c).forEach(function (child) { |
|
26 |
- if (child.type && child.type.displayName === 'SwiperSlide') { |
|
27 |
- slides.push(child); |
|
28 |
- } else if (child.props && child.props.slot && slots[child.props.slot]) { |
|
29 |
- slots[child.props.slot].push(child); |
|
30 |
- } else if (child.props && child.props.children) { |
|
31 |
- var foundSlides = processChildren(child.props.children); |
|
32 |
- |
|
33 |
- if (foundSlides.length > 0) { |
|
34 |
- foundSlides.forEach(function (slide) { |
|
35 |
- return slides.push(slide); |
|
36 |
- }); |
|
37 |
- } else { |
|
38 |
- slots['container-end'].push(child); |
|
39 |
- } |
|
40 |
- } else { |
|
41 |
- slots['container-end'].push(child); |
|
42 |
- } |
|
43 |
- }); |
|
44 |
- return { |
|
45 |
- slides: slides, |
|
46 |
- slots: slots |
|
47 |
- }; |
|
48 |
-} |
|
49 |
- |
|
50 |
-export { getChildren }; |
|
51 | 0 |
\ No newline at end of file |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,50 @@ |
1 |
+import React from 'react'; |
|
2 |
+ |
|
3 |
+function processChildren(c) { |
|
4 |
+ var slides = []; |
|
5 |
+ React.Children.toArray(c).forEach(function (child) { |
|
6 |
+ if (child.type && child.type.displayName === 'SwiperSlide') { |
|
7 |
+ slides.push(child); |
|
8 |
+ } else if (child.props && child.props.children) { |
|
9 |
+ processChildren(child.props.children).forEach(function (slide) { |
|
10 |
+ return slides.push(slide); |
|
11 |
+ }); |
|
12 |
+ } |
|
13 |
+ }); |
|
14 |
+ return slides; |
|
15 |
+} |
|
16 |
+ |
|
17 |
+function getChildren(c) { |
|
18 |
+ var slides = []; |
|
19 |
+ var slots = { |
|
20 |
+ 'container-start': [], |
|
21 |
+ 'container-end': [], |
|
22 |
+ 'wrapper-start': [], |
|
23 |
+ 'wrapper-end': [] |
|
24 |
+ }; |
|
25 |
+ React.Children.toArray(c).forEach(function (child) { |
|
26 |
+ if (child.type && child.type.displayName === 'SwiperSlide') { |
|
27 |
+ slides.push(child); |
|
28 |
+ } else if (child.props && child.props.slot && slots[child.props.slot]) { |
|
29 |
+ slots[child.props.slot].push(child); |
|
30 |
+ } else if (child.props && child.props.children) { |
|
31 |
+ var foundSlides = processChildren(child.props.children); |
|
32 |
+ |
|
33 |
+ if (foundSlides.length > 0) { |
|
34 |
+ foundSlides.forEach(function (slide) { |
|
35 |
+ return slides.push(slide); |
|
36 |
+ }); |
|
37 |
+ } else { |
|
38 |
+ slots['container-end'].push(child); |
|
39 |
+ } |
|
40 |
+ } else { |
|
41 |
+ slots['container-end'].push(child); |
|
42 |
+ } |
|
43 |
+ }); |
|
44 |
+ return { |
|
45 |
+ slides: slides, |
|
46 |
+ slots: slots |
|
47 |
+ }; |
|
48 |
+} |
|
49 |
+ |
|
50 |
+export { getChildren }; |
|
0 | 51 |
\ No newline at end of file |