2023-05-06 15:49:37 +08:00
|
|
|
import * as React from 'react';
|
2024-01-06 18:05:25 +08:00
|
|
|
import { Button, Flex, Typography } from 'antd';
|
|
|
|
import { createStyles, css, useTheme } from 'antd-style';
|
2023-07-20 19:27:33 +08:00
|
|
|
import classNames from 'classnames';
|
2024-01-06 18:05:25 +08:00
|
|
|
import { Link, useLocation } from 'dumi';
|
|
|
|
|
2022-11-09 12:28:04 +08:00
|
|
|
import useLocale from '../../../hooks/useLocale';
|
2023-02-03 13:39:46 +08:00
|
|
|
import SiteContext from '../../../theme/slots/SiteContext';
|
2022-11-10 19:46:44 +08:00
|
|
|
import * as utils from '../../../theme/utils';
|
2024-04-06 16:11:17 +08:00
|
|
|
import GroupMaskLayer from './GroupMaskLayer';
|
2022-11-09 12:28:04 +08:00
|
|
|
|
|
|
|
const locales = {
|
|
|
|
cn: {
|
2022-11-18 23:17:13 +08:00
|
|
|
slogan: '助力设计开发者「更灵活」地搭建出「更美」的产品,让用户「快乐工作」~',
|
2022-11-09 12:28:04 +08:00
|
|
|
start: '开始使用',
|
|
|
|
designLanguage: '设计语言',
|
|
|
|
},
|
|
|
|
en: {
|
|
|
|
slogan:
|
2022-11-18 23:17:13 +08:00
|
|
|
'Help designers/developers building beautiful products more flexible and working with happiness',
|
|
|
|
start: 'Getting Started',
|
2022-11-09 12:28:04 +08:00
|
|
|
designLanguage: 'Design Language',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2022-12-11 20:39:46 +08:00
|
|
|
const useStyle = () => {
|
|
|
|
const { isMobile } = React.useContext(SiteContext);
|
2023-07-20 19:27:33 +08:00
|
|
|
return createStyles(({ token }) => ({
|
2022-12-11 20:39:46 +08:00
|
|
|
titleBase: css`
|
|
|
|
h1& {
|
|
|
|
font-family: AliPuHui, ${token.fontFamily};
|
|
|
|
}
|
|
|
|
`,
|
|
|
|
title: isMobile
|
|
|
|
? css`
|
|
|
|
h1& {
|
|
|
|
margin-bottom: ${token.margin}px;
|
|
|
|
font-weight: normal;
|
|
|
|
font-size: ${token.fontSizeHeading1 + 2}px;
|
|
|
|
line-height: ${token.lineHeightHeading2};
|
|
|
|
}
|
|
|
|
`
|
|
|
|
: css`
|
|
|
|
h1& {
|
|
|
|
margin-bottom: ${token.marginMD}px;
|
|
|
|
font-weight: 900;
|
|
|
|
font-size: 68px;
|
|
|
|
}
|
|
|
|
`,
|
2024-01-06 18:05:25 +08:00
|
|
|
btnWrap: css`
|
|
|
|
margin-bottom: ${token.marginXL}px;
|
|
|
|
`,
|
2024-04-06 16:11:17 +08:00
|
|
|
layer: css`
|
|
|
|
text-align: center;
|
|
|
|
padding-top: ${token.marginFar - 16}px;
|
|
|
|
padding-bottom: ${token.marginFarSM}px;
|
|
|
|
`,
|
|
|
|
mobileBg: css`
|
|
|
|
width: 100%;
|
|
|
|
`,
|
|
|
|
videoWrap: css`
|
|
|
|
height: 320px;
|
|
|
|
background-color: #77c6ff;
|
|
|
|
display: flex;
|
|
|
|
flex-wrap: nowrap;
|
|
|
|
justify-content: center;
|
|
|
|
`,
|
|
|
|
video: css`
|
|
|
|
height: 100%;
|
|
|
|
object-fit: contain;
|
|
|
|
`,
|
|
|
|
bg: css`
|
|
|
|
flex: auto;
|
|
|
|
background-repeat: repeat-x;
|
|
|
|
background-size: auto 100%;
|
|
|
|
`,
|
|
|
|
bg1: css`
|
|
|
|
background-image: url(https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*6d50SboraPIAAAAAAAAAAAAAARQnAQ);
|
|
|
|
background-position: 100% 0;
|
|
|
|
`,
|
|
|
|
bg2: css`
|
|
|
|
background-image: url(https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*8ILtRrQlVDMAAAAAAAAAAAAAARQnAQ);
|
|
|
|
background-position: 0 0;
|
|
|
|
margin-inline-start: -1px;
|
|
|
|
`,
|
2023-07-20 19:27:33 +08:00
|
|
|
}))();
|
2022-12-11 20:39:46 +08:00
|
|
|
};
|
|
|
|
|
2024-01-06 18:05:25 +08:00
|
|
|
const Banner: React.FC<React.PropsWithChildren> = ({ children }) => {
|
2022-11-30 11:05:41 +08:00
|
|
|
const [locale] = useLocale(locales);
|
2022-11-10 19:46:44 +08:00
|
|
|
const { pathname, search } = useLocation();
|
2023-07-20 19:27:33 +08:00
|
|
|
const token = useTheme();
|
|
|
|
const { styles } = useStyle();
|
2022-12-11 20:39:46 +08:00
|
|
|
const { isMobile } = React.useContext(SiteContext);
|
2022-11-10 19:46:44 +08:00
|
|
|
const isZhCN = utils.isZhCN(pathname);
|
2022-11-09 12:28:04 +08:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{/* Banner Placeholder Motion */}
|
2022-12-11 20:39:46 +08:00
|
|
|
{isMobile ? (
|
2022-12-15 10:18:41 +08:00
|
|
|
<img
|
2024-04-06 16:11:17 +08:00
|
|
|
className={styles.mobileBg}
|
2022-12-15 10:18:41 +08:00
|
|
|
src="https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*JmlaR5oQn3MAAAAAAAAAAAAADrJ8AQ/original"
|
|
|
|
alt=""
|
|
|
|
/>
|
2022-12-11 20:39:46 +08:00
|
|
|
) : (
|
2024-04-06 16:11:17 +08:00
|
|
|
<div className={classNames(styles.videoWrap)}>
|
|
|
|
<div className={classNames(styles.bg, styles.bg1)} />
|
|
|
|
<video className={styles.video} autoPlay muted loop>
|
2022-12-11 20:39:46 +08:00
|
|
|
<source
|
|
|
|
type="video/webm"
|
2024-04-06 16:11:17 +08:00
|
|
|
src="https://mdn.alipayobjects.com/huamei_iwk9zp/afts/file/A*uYT7SZwhJnUAAAAAAAAAAAAADgCCAQ"
|
2022-12-11 20:39:46 +08:00
|
|
|
/>
|
|
|
|
<source
|
|
|
|
type="video/mp4"
|
2024-04-06 16:11:17 +08:00
|
|
|
src="https://gw.alipayobjects.com/mdn/rms_08e378/afts/file/A*XYYNQJ3NbmMAAAAAAAAAAAAAARQnAQ"
|
2022-12-11 20:39:46 +08:00
|
|
|
/>
|
|
|
|
</video>
|
2024-04-06 16:11:17 +08:00
|
|
|
<div className={classNames(styles.bg, styles.bg2)} />
|
2022-12-11 20:39:46 +08:00
|
|
|
</div>
|
|
|
|
)}
|
2022-11-09 12:28:04 +08:00
|
|
|
|
|
|
|
{/* Logo */}
|
|
|
|
<div style={{ position: 'relative', background: '#fff' }}>
|
|
|
|
{/* Image Bottom Right */}
|
|
|
|
<img
|
|
|
|
style={{ position: 'absolute', right: 0, top: 240, width: 240 }}
|
|
|
|
src="https://gw.alipayobjects.com/zos/bmw-prod/b3b8dc41-dce8-471f-9d81-9a0204f27d03.svg"
|
2022-11-30 11:05:41 +08:00
|
|
|
alt="Ant Design"
|
2022-11-09 12:28:04 +08:00
|
|
|
/>
|
2024-04-06 16:11:17 +08:00
|
|
|
<GroupMaskLayer className={styles.layer}>
|
2022-11-09 12:28:04 +08:00
|
|
|
{/* Image Left Top */}
|
|
|
|
<img
|
2022-12-11 20:39:46 +08:00
|
|
|
style={{ position: 'absolute', left: isMobile ? -120 : 0, top: 0, width: 240 }}
|
2022-11-09 12:28:04 +08:00
|
|
|
src="https://gw.alipayobjects.com/zos/bmw-prod/49f963db-b2a8-4f15-857a-270d771a1204.svg"
|
2022-11-30 11:05:41 +08:00
|
|
|
alt="bg"
|
2022-11-09 12:28:04 +08:00
|
|
|
/>
|
2022-12-11 20:39:46 +08:00
|
|
|
{/* Image Right Top */}
|
2022-11-09 12:28:04 +08:00
|
|
|
<img
|
2022-12-11 20:39:46 +08:00
|
|
|
style={{ position: 'absolute', right: isMobile ? 0 : 120, top: 0, width: 240 }}
|
2022-11-09 12:28:04 +08:00
|
|
|
src="https://gw.alipayobjects.com/zos/bmw-prod/e152223c-bcae-4913-8938-54fda9efe330.svg"
|
2022-11-30 11:05:41 +08:00
|
|
|
alt="bg"
|
2022-11-09 12:28:04 +08:00
|
|
|
/>
|
|
|
|
|
2023-07-20 19:27:33 +08:00
|
|
|
<Typography.Title level={1} className={classNames(styles.titleBase, styles.title)}>
|
2022-11-09 12:28:04 +08:00
|
|
|
Ant Design 5.0
|
|
|
|
</Typography.Title>
|
|
|
|
<Typography.Paragraph
|
|
|
|
style={{
|
2022-12-11 20:39:46 +08:00
|
|
|
fontSize: isMobile ? token.fontSizeHeading5 - 2 : token.fontSizeHeading5,
|
|
|
|
lineHeight: isMobile ? token.lineHeightSM : token.lineHeightHeading5,
|
2022-11-09 12:28:04 +08:00
|
|
|
marginBottom: token.marginMD * 2,
|
2022-12-11 20:39:46 +08:00
|
|
|
padding: isMobile ? `0 ${token.paddingLG + 2}px` : 0,
|
2022-11-09 12:28:04 +08:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
<div>{locale.slogan}</div>
|
|
|
|
</Typography.Paragraph>
|
2024-01-06 18:05:25 +08:00
|
|
|
<Flex gap="middle" className={styles.btnWrap}>
|
2022-11-10 19:46:44 +08:00
|
|
|
<Link to={utils.getLocalizedPathname('/components/overview/', isZhCN, search)}>
|
|
|
|
<Button size="large" type="primary">
|
|
|
|
{locale.start}
|
|
|
|
</Button>
|
|
|
|
</Link>
|
|
|
|
<Link to={utils.getLocalizedPathname('/docs/spec/introduce/', isZhCN, search)}>
|
|
|
|
<Button size="large">{locale.designLanguage}</Button>
|
|
|
|
</Link>
|
2024-01-06 18:05:25 +08:00
|
|
|
</Flex>
|
2022-11-09 12:28:04 +08:00
|
|
|
{children}
|
2024-04-06 16:11:17 +08:00
|
|
|
</GroupMaskLayer>
|
2022-11-09 12:28:04 +08:00
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
);
|
2024-01-06 18:05:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
export default Banner;
|