ant-design/site/theme/template/Home/Banner.jsx

134 lines
4.4 KiB
React
Raw Normal View History

2016-03-03 17:23:08 +08:00
import React from 'react';
2018-01-04 20:00:38 +08:00
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';
2019-08-08 12:35:48 +08:00
import { FormattedMessage, useIntl } from 'react-intl';
2018-01-05 16:14:59 +08:00
import GitHubButton from 'react-github-button';
2019-10-16 11:03:16 +08:00
import { Button, Divider } from 'antd';
import { RightOutlined } from '@ant-design/icons';
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
2019-08-08 12:35:48 +08:00
const Banner = ({ isMobile }) => {
const { locale } = useIntl();
const isZhCN = locale === 'zh-CN';
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 },
]}
>
2019-08-08 12:35:48 +08:00
<ellipse 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 },
]}
>
2019-08-08 12:35:48 +08:00
<g transform="translate(200 450)">
<g style={{ transformOrigin: '50% 50%', transform: 'rotate(-340deg)' }}>
<rect stroke="#FADB14" strokeWidth="1.6" width="9" height="9" />
2018-01-04 20:00:38 +08:00
</g>
2019-08-08 12:35:48 +08:00
</g>
</TweenOne>
</svg>
<ScrollParallax
location="banner"
className="banner-bg"
animation={{ playScale: [1, 1.5], rotate: 0 }}
/>
</div>
<QueueAnim className="banner page" type="alpha" delay={150}>
{isMobile && (
<div className="img-wrapper" key="image">
<BannerImage />
</div>
)}
<QueueAnim className="text-wrapper" key="text" type="bottom">
<h1 key="h1">Ant Design</h1>
<p key="p">
<FormattedMessage id="app.home.introduce" />
</p>
<div className="banner-btns" key="buttons">
<Link to={utils.getLocalizedPathname('/docs/react/introduce', isZhCN)}>
<Button type="primary" className="banner-btn components">
<FormattedMessage id="app.home.getting-started" />
</Button>
</Link>
<Link
to={utils.getLocalizedPathname('/docs/spec/introduce', isZhCN)}
style={{ marginLeft: 16 }}
>
<Button className="banner-btn language">
<FormattedMessage id="app.home.design-language" />
</Button>
</Link>
{!isMobile && (
<GitHubButton
style={{ marginLeft: 16 }}
2019-08-08 12:35:48 +08:00
size="large"
type="stargazers"
namespace="ant-design"
repo="ant-design"
2018-12-07 16:17:45 +08:00
/>
2019-08-08 12:35:48 +08:00
)}
</div>
2019-10-14 12:26:44 +08:00
<div
key="promote"
className="banner-promote"
style={{
width: isZhCN ? 412 : 522,
}}
>
<Divider>
<FormattedMessage id="app.home.recommend" />
</Divider>
<a
2019-11-30 00:03:16 +08:00
href="https://github.com/antvis/g2plot?from=antd"
2019-10-14 12:26:44 +08:00
target="_blank"
rel="noopener noreferrer"
onClick={() => {
if (window.gtag) {
window.gtag('event', '点击', {
event_category: '首页推广',
2019-11-30 00:03:16 +08:00
event_label: `https://github.com/antvis/g2plot?from=antd`,
2019-10-14 12:26:44 +08:00
});
}
}}
>
<img src="https://antv.vision/icons/icon-512x512.png" alt="AntV logo" />
2019-11-30 00:03:16 +08:00
<FormattedMessage id="app.home.recommend.antv.g2plot" />
<RightOutlined style={{ marginLeft: 6, fontSize: 12, opacity: 0.6 }} />
2019-10-14 12:26:44 +08:00
</a>
</div>
</QueueAnim>
2019-08-08 12:35:48 +08:00
{!isMobile && (
<div className="img-wrapper" key="image">
<ScrollParallax
location="banner"
component={BannerImage}
animation={{ playScale: [1, 1.5], y: 80 }}
/>
</div>
)}
</QueueAnim>
</div>
);
};
2018-01-04 20:00:38 +08:00
export default Banner;