Content0.jsx
1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import React from 'react';
import QueueAnim from 'rc-queue-anim';
import { Row, Col } from 'antd';
import OverPack from 'rc-scroll-anim/lib/ScrollOverPack';
class Content extends React.PureComponent {
getBlockChildren = data => data.map((item, i) => {
const children = item.children;
return (
<Col key={i.toString()} {...item}>
<div {...children.icon}>
<img src={children.icon.children} width="100%" alt="img" />
</div>
<h3 {...children.title}>{children.title.children}</h3>
<p {...children.content}>{children.content.children}</p>
</Col>
);
});
render() {
const { ...props } = this.props;
const { dataSource } = props;
delete props.dataSource;
delete props.isMobile;
const listChildren = this.getBlockChildren(dataSource.block.children);
return (
<div {...props} {...dataSource.wrapper}>
<div {...dataSource.page}>
<div {...dataSource.titleWrapper}>
{dataSource.titleWrapper.children.map((item, i) => React.createElement(
item.name.indexOf('title') === 0 ? 'h1' : 'div',
{ key: i.toString(), ...item },
item.children.match(
/\.(svg|gif|jpg|jpeg|png|JPG|PNG|GIF|JPEG)$/
)
? React.createElement('img', {
src: item.children,
height: '100%',
alt: 'img',
})
: item.children
)
)}
</div>
<OverPack {...dataSource.OverPack}>
<QueueAnim
type="bottom"
key="block"
leaveReverse
{...dataSource.block}
component={Row}
>
{listChildren}
</QueueAnim>
</OverPack>
</div>
</div>
);
}
}
export default Content;