-
Notifications
You must be signed in to change notification settings - Fork 0
/
Banner.tsx
53 lines (50 loc) · 1.42 KB
/
Banner.tsx
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
import React from 'react';
import { Button } from 'antd';
import { DownOutlined } from '@ant-design/icons';
import QueueAnim from 'rc-queue-anim';
import TweenOne from 'rc-tween-one';
import { isImg } from './utils';
import { Link } from 'react-router-dom';
import { BannerProps } from '../types';
const Banner: React.FC<BannerProps> = ({ dataSource }: BannerProps) => {
return (
<div {...dataSource.wrapper}>
<QueueAnim
key="QueueAnim"
type={['bottom', 'top']}
delay={200}
{...dataSource.textWrapper}
>
<div key="title" {...dataSource.title}>
{typeof dataSource.title.children === 'string' &&
dataSource.title.children.match(isImg) ? (
<img src={dataSource.title.children} width="100%" alt="img" />
) : (
dataSource.title.children
)}
</div>
<div key="content" {...dataSource.content}>
{dataSource.content.children}
</div>
<Link to={"/Service"}>
<Button ghost key="button" {...dataSource.button}>
{dataSource.button.children}
</Button>
</Link>
</QueueAnim>
<TweenOne
animation={{
y: "-=20",
yoyo: true,
repeat: -1,
duration: 1000,
}}
className="banner0-icon"
key="icon"
>
<DownOutlined />
</TweenOne>
</div>
);
};
export default Banner;