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

224 lines
8.2 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 { Row, Col, Icon } from 'antd';
2016-03-30 19:14:09 +08:00
import QueueAnim from 'rc-queue-anim';
2018-01-04 20:00:38 +08:00
import ScrollOverPack from 'rc-scroll-anim/lib/ScrollOverPack';
2018-01-05 14:07:10 +08:00
import { Link } from 'bisheng/router';
2018-01-04 20:00:38 +08:00
import { FormattedMessage } from 'react-intl';
2018-01-05 14:07:10 +08:00
import * as utils from '../utils';
2016-03-03 17:23:08 +08:00
2018-01-04 20:00:38 +08:00
import svgBgToParallax from './util';
const page2Data = [
{
img: 'https://gw.alipayobjects.com/zos/rmsportal/eYNnmGagLWdrkdMHVUuA.svg',
name: 'Ant Design Components',
},
{
img: 'https://gw.alipayobjects.com/zos/rmsportal/EPaPtDVGnJhyqyBAUZMl.svg',
name: 'Ant Design Pro',
2018-12-07 16:17:45 +08:00
slogan: <FormattedMessage id="app.home.product-pro-slogan" />,
2018-01-05 14:07:10 +08:00
link: 'https://pro.ant.design/index-cn',
2018-01-04 20:00:38 +08:00
},
{
img: 'https://gw.alipayobjects.com/zos/rmsportal/GobRAKexhfTSJdLFzDFY.svg',
name: 'Ant Design Mobile',
2018-12-07 16:17:45 +08:00
slogan: <FormattedMessage id="app.home.product-mobile-slogan" />,
2018-01-04 20:00:38 +08:00
},
{
img: 'https://gw.alipayobjects.com/zos/rmsportal/slVtnOCcgeAcLEPwtewY.svg',
name: 'AntV',
2018-12-07 16:17:45 +08:00
slogan: <FormattedMessage id="app.home.product-antv-slogan" />,
2018-01-05 14:07:10 +08:00
link: 'https://antv.alipay.com/zh-cn/index.html',
2018-01-04 20:00:38 +08:00
},
2018-11-09 16:18:15 +08:00
{
img: 'https://gw.alipayobjects.com/zos/rmsportal/EAHlyTmYeDtTkZIPbUnP.svg',
name: 'Ant Design Landing',
2018-12-07 16:17:45 +08:00
slogan: <FormattedMessage id="app.home.product-landing-slogan" />,
2018-11-09 16:18:15 +08:00
link: 'https://landing.ant.design',
new: true,
},
2018-01-04 20:00:38 +08:00
];
const svgBgChild = [
2018-12-07 16:17:45 +08:00
<svg
2019-08-02 17:59:42 +08:00
key="svg-0"
2018-12-07 16:17:45 +08:00
width="100%"
height="100%"
viewBox="0 0 1401 1109"
stroke="none"
strokeWidth="1"
fill="none"
fillRule="evenodd"
preserveAspectRatio="xMidYMid slice"
>
<g transform="translate(-79.000000, -21.000000)">
<circle stroke="none" fill="#EBEDF0" fillRule="evenodd" cx="98.5" cy="98.5" r="98.5" />
2018-12-07 16:17:45 +08:00
<rect
id="Rectangle-33"
stroke="none"
fill="#EBEDF0"
fillRule="evenodd"
transform="translate(1261.132034, 1217.132034) rotate(45.000000) translate(-1261.132034, -1217.132034) "
x="1111.13203"
y="1007.13203"
width="300"
height="300"
rx="1"
/>
<circle stroke="#EBEDF0" strokeWidth="16" fill="none" cx="1402" cy="151" r="70" />
2018-12-07 16:17:45 +08:00
<path
d="M385.032144,960.394832 L394.316344,976.475539 C394.868629,977.432124 394.540879,978.655305 393.584293,979.20759 C393.280255,979.383126 392.935367,979.475539 392.584293,979.475539 L374.015893,979.475539 C372.911323,979.475539 372.015893,978.580108 372.015893,977.475539 C372.015893,977.124466 372.108305,976.779577 372.283842,976.475539 L381.568042,960.394832 C382.120327,959.438247 383.343508,959.110497 384.300093,959.662781 C384.604131,959.838318 384.856607,960.090794 385.032144,960.394832 Z"
stroke="none"
fill="#A3B1BF"
fillRule="evenodd"
transform="translate(383.300093, 970.709623) rotate(70.000000) translate(-383.300093, -970.709623) "
/>
<path
d="M545.537489,211.431472 L552.545207,223.569196 C553.097492,224.525781 552.769741,225.748962 551.813156,226.301246 C551.509118,226.476783 551.164229,226.569196 550.813156,226.569196 L536.79772,226.569196 C535.693151,226.569196 534.79772,225.673765 534.79772,224.569196 C534.79772,224.218122 534.890133,223.873234 535.06567,223.569196 L542.073387,211.431472 C542.625672,210.474887 543.848853,210.147137 544.805438,210.699421 C545.109477,210.874958 545.361952,211.127434 545.537489,211.431472 Z"
stroke="none"
fill="#A3B1BF"
fillRule="evenodd"
transform="translate(543.805605, 218.500167) rotate(90.000000) translate(-543.805605, -218.500167) "
/>
<g id="Group-26" transform="translate(146.000000, 338.000000)" fill="#FADB14">
<image xlinkHref="https://gw.alipayobjects.com/zos/rmsportal/UtBesTOkoZsBUxPqfDlZ.svg" />
2018-01-04 20:00:38 +08:00
</g>
2018-12-07 16:17:45 +08:00
</g>
</svg>,
<svg
2019-08-02 17:59:42 +08:00
key="svg-1"
2018-12-07 16:17:45 +08:00
width="1311px"
height="920px"
viewBox="0 0 1311 920"
stroke="none"
strokeWidth="1"
fill="none"
fillRule="evenodd"
>
<g id="Group-29" transform="translate(283.000000, 920.000000)" fill="#2F54EB">
<image xlinkHref="https://gw.alipayobjects.com/zos/rmsportal/VrADJaRPMnFjmtmIhObV.svg" />
</g>
<circle stroke="#13C2C2" strokeWidth="4" opacity="0.95" cx="1096" cy="11" r="11" />
<circle stroke="#13C2C2" strokeWidth="4" cx="11" cy="667" r="11" />
2018-12-07 16:17:45 +08:00
<g id="Group-11" transform="translate(1207.000000, 419.000000)" fill="#13C2C2">
<image xlinkHref="https://gw.alipayobjects.com/zos/rmsportal/MnLEmwjipfhzPUmBJnJE.svg" />
</g>
<g id="Group-28" transform="translate(884.000000, 880.000000)" fill="#2F54EB">
<image xlinkHref="https://gw.alipayobjects.com/zos/rmsportal/dyNuxLOZtvjoHSVisbhQ.svg" />
</g>
</svg>,
2018-01-04 20:00:38 +08:00
];
const svgBgChildArray = svgBgChild.map((item, i) => {
2018-12-07 16:17:45 +08:00
const {
props: { children },
} = item;
return React.cloneElement(item, { children: svgBgToParallax(children, i) });
2018-01-04 20:00:38 +08:00
});
2018-01-05 17:23:59 +08:00
export default function Page2({ isMobile, locale }) {
2018-01-05 14:07:10 +08:00
const isZhCN = locale === 'zh-CN';
2018-01-04 20:00:38 +08:00
const componentButton = (
<div key="b" className="components-button-wrapper">
2018-01-05 14:07:10 +08:00
<Link to={utils.getLocalizedPathname('/docs/react/introduce', isZhCN)}>
Ant Design of React <Icon type="right" />
2018-01-05 14:07:10 +08:00
</Link>
<a href="https://ng.ant.design/" target="_black">
Ant Design of Angular <Icon type="right" />
2018-01-05 14:07:10 +08:00
</a>
2019-02-17 00:17:53 +08:00
<a href="https://vue.ant.design/" target="_black">
Ant Design of Vue <Icon type="right" />
</a>
2018-01-04 20:00:38 +08:00
</div>
);
const children = page2Data.map((item, i) => {
2018-01-05 17:23:59 +08:00
if (!isMobile && !i) {
2018-01-04 20:00:38 +08:00
return null;
}
const mobileContent = (
<div className="components-button-wrapper">
<p key="p">{item.slogan}</p>
<a className="more-mobile-react" href="https://mobile.ant.design" target="_black">
<FormattedMessage id="app.home.more-mobile-react" />
<Icon type="right" />
</a>
<a className="more-mobile-angular" href="http://ng.mobile.ant.design" target="_black">
<FormattedMessage id="app.home.more-mobile-angular" />
<Icon type="right" />
</a>
</div>
);
2018-12-07 16:17:45 +08:00
const moreContent =
i === 2
? mobileContent
: [
<p key="p">{item.slogan}</p>,
<span className="more" key="a">
<FormattedMessage id="app.home.more" /> <Icon type="right" />
</span>,
];
const content = isMobile && !i ? componentButton : moreContent;
const BlockElement = item.link ? 'a' : 'div';
2018-01-04 20:00:38 +08:00
return (
<BlockElement
className="product-block"
key={item.name}
href={item.link}
style={{ display: 'block' }}
>
2018-01-08 12:16:59 +08:00
<Row>
<Col
xs={8}
md={i === 2 ? 6 : 8}
className={`block-image-wrapper${i % 2 ? ' right' : ''}`}
>
<img src={item.img} style={isMobile && i === 2 ? { marginLeft: 16 } : {}} alt="icon" />
</Col>
<Col xs={16} md={i === 2 ? 18 : 16} className="block-text-wrapper">
2018-12-07 16:17:45 +08:00
<h4>
{item.name} {item.new && <span className="new">NEW</span>}
</h4>
2018-01-08 12:16:59 +08:00
{content}
</Col>
</Row>
</BlockElement>
2018-01-04 20:00:38 +08:00
);
});
return (
2018-01-04 20:00:38 +08:00
<div className="home-page-wrapper page2" id="page2">
<div className="page">
2018-12-07 16:17:45 +08:00
<h2>
<FormattedMessage id="app.home.solution" />
</h2>
2018-01-04 20:00:38 +08:00
<ScrollOverPack component={Row} className="page2-content" playScale="0.4">
<QueueAnim
component={Col}
componentProps={{ xs: 24, md: 12 }}
className="page2-components"
key="left"
type="bottom"
leaveReverse
>
<h3 key="h1">Ant Design Components</h3>
2018-12-07 16:17:45 +08:00
<p key="p">
<FormattedMessage id="app.home.components-explain" />
</p>
2018-01-04 20:00:38 +08:00
{componentButton}
</QueueAnim>
<QueueAnim
component={Col}
componentProps={{ xs: 24, md: 12 }}
className="page2-product"
key="right"
type="bottom"
leaveReverse
>
{children}
</QueueAnim>
</ScrollOverPack>
</div>
2018-12-07 16:17:45 +08:00
<div className="parallax-bg bottom">{svgBgChildArray[0]}</div>
<div className="parallax-bg top">{svgBgChildArray[1]}</div>
2018-01-04 20:00:38 +08:00
</div>
);
2016-03-03 17:23:08 +08:00
}