2016-03-03 17:23:08 +08:00
|
|
|
import React from 'react';
|
2018-01-04 20:00:38 +08:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import TweenOne from 'rc-tween-one';
|
2016-03-30 19:14:09 +08:00
|
|
|
import QueueAnim from 'rc-queue-anim';
|
2018-01-04 20:00:38 +08:00
|
|
|
import ScrollParallax from 'rc-scroll-anim/lib/ScrollParallax';
|
2018-01-08 12:16:59 +08:00
|
|
|
import { Link } from 'bisheng/router';
|
2018-01-04 20:00:38 +08:00
|
|
|
import { FormattedMessage } from 'react-intl';
|
2018-01-05 16:14:59 +08:00
|
|
|
import GitHubButton from 'react-github-button';
|
2018-01-04 20:00:38 +08:00
|
|
|
import BannerImage from './BannerImage';
|
2018-01-08 12:16:59 +08:00
|
|
|
import * as utils from '../utils';
|
2016-03-03 17:23:08 +08:00
|
|
|
|
2018-01-04 20:00:38 +08:00
|
|
|
const loop = {
|
|
|
|
duration: 3000,
|
|
|
|
yoyo: true,
|
|
|
|
repeat: -1,
|
|
|
|
};
|
2016-03-03 17:23:08 +08:00
|
|
|
|
2018-01-04 20:00:38 +08:00
|
|
|
class Banner extends React.PureComponent {
|
2018-01-08 12:16:59 +08:00
|
|
|
static contextTypes = {
|
|
|
|
intl: PropTypes.object.isRequired,
|
|
|
|
}
|
2018-06-22 21:05:13 +08:00
|
|
|
|
2018-01-04 20:00:38 +08:00
|
|
|
static propTypes = {
|
|
|
|
className: PropTypes.string,
|
|
|
|
}
|
2018-06-22 21:05:13 +08:00
|
|
|
|
2018-01-04 20:00:38 +08:00
|
|
|
static defaultProps = {
|
|
|
|
className: 'banner',
|
|
|
|
}
|
2018-06-22 21:05:13 +08:00
|
|
|
|
2018-01-04 20:00:38 +08:00
|
|
|
render() {
|
2018-01-05 17:54:02 +08:00
|
|
|
const { className, isMobile } = this.props;
|
2018-06-22 21:05:13 +08:00
|
|
|
const { intl: { locale } } = this.context;
|
2018-01-08 12:16:59 +08:00
|
|
|
const isZhCN = locale === 'zh-CN';
|
2018-01-04 20:00:38 +08:00
|
|
|
return (
|
|
|
|
<div className="home-page-wrapper banner-wrapper" id="banner">
|
|
|
|
<div className="banner-bg-wrapper">
|
|
|
|
<svg width="400px" height="576px" viewBox="0 0 400 576" fill="none">
|
|
|
|
<TweenOne component="g" animation={[{ opacity: 0, type: 'from' }, { ...loop, y: 15 }]}>
|
|
|
|
<ellipse id="Oval-9-Copy-4" cx="100" cy="100" rx="6" ry="6" stroke="#2F54EB" strokeWidth="1.6" />
|
|
|
|
</TweenOne>
|
|
|
|
<TweenOne component="g" animation={[{ opacity: 0, type: 'from' }, { ...loop, y: -15 }]}>
|
2018-01-05 16:14:59 +08:00
|
|
|
<g transform="translate(200 450)">
|
2018-01-04 20:00:38 +08:00
|
|
|
<g style={{ transformOrigin: '50% 50%', transform: 'rotate(-340deg)' }}>
|
|
|
|
<rect stroke="#FADB14" strokeWidth="1.6" width="9" height="9" />
|
|
|
|
</g>
|
|
|
|
</g>
|
|
|
|
</TweenOne>
|
|
|
|
</svg>
|
|
|
|
<ScrollParallax location="banner" className="banner-bg" animation={{ playScale: [1, 1.5], rotate: 0 }} />
|
|
|
|
</div>
|
|
|
|
<QueueAnim className={`${className} page`} type="alpha" delay={150}>
|
2018-10-23 12:21:26 +08:00
|
|
|
{
|
|
|
|
isMobile && (
|
|
|
|
<div className="img-wrapper" key="image">
|
|
|
|
<BannerImage />
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
2018-01-04 20:00:38 +08:00
|
|
|
<QueueAnim
|
|
|
|
className="text-wrapper"
|
|
|
|
key="text"
|
|
|
|
type="bottom"
|
|
|
|
>
|
|
|
|
<h1 key="h1">
|
|
|
|
Ant Design
|
|
|
|
</h1>
|
|
|
|
<p key="p">
|
|
|
|
<FormattedMessage id="app.home.introduce" />
|
|
|
|
</p>
|
2018-05-12 14:02:34 +08:00
|
|
|
<div className="banner-btns" key="buttons">
|
|
|
|
<Link className="banner-btn components" to={utils.getLocalizedPathname('/docs/react/introduce', isZhCN)}>
|
|
|
|
<FormattedMessage id="app.home.getting-started" />
|
|
|
|
</Link>
|
|
|
|
<Link className="banner-btn language" to={utils.getLocalizedPathname('/docs/spec/introduce', isZhCN)}>
|
|
|
|
<FormattedMessage id="app.home.design-language" />
|
|
|
|
</Link>
|
|
|
|
{!isMobile && (
|
2018-01-09 14:27:56 +08:00
|
|
|
<GitHubButton
|
|
|
|
key="github-button"
|
|
|
|
size="large"
|
|
|
|
type="stargazers"
|
|
|
|
namespace="ant-design"
|
|
|
|
repo="ant-design"
|
|
|
|
/>
|
2018-05-12 14:02:34 +08:00
|
|
|
)}
|
|
|
|
</div>
|
2018-01-04 20:00:38 +08:00
|
|
|
</QueueAnim>
|
2018-01-05 17:54:02 +08:00
|
|
|
{!isMobile && (
|
2018-01-04 20:00:38 +08:00
|
|
|
<div className="img-wrapper" key="image">
|
|
|
|
<ScrollParallax location="banner" component={BannerImage} animation={{ playScale: [1, 1.5], y: 80 }} />
|
2018-05-12 14:02:34 +08:00
|
|
|
</div>
|
|
|
|
)}
|
2016-09-27 10:06:34 +08:00
|
|
|
</QueueAnim>
|
2018-01-04 20:00:38 +08:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2016-03-03 17:23:08 +08:00
|
|
|
}
|
2018-01-04 20:00:38 +08:00
|
|
|
|
|
|
|
export default Banner;
|