2023-10-21 16:39:59 +08:00
|
|
|
import React, { Suspense } from 'react';
|
2023-08-25 19:08:52 +08:00
|
|
|
import { ConfigProvider, theme } from 'antd';
|
2023-07-20 19:27:33 +08:00
|
|
|
import { createStyles, css } from 'antd-style';
|
2023-08-25 19:08:52 +08:00
|
|
|
|
|
|
|
import useDark from '../../hooks/useDark';
|
2022-11-09 12:28:04 +08:00
|
|
|
import useLocale from '../../hooks/useLocale';
|
2023-08-25 19:08:52 +08:00
|
|
|
// import BannerRecommends, { BannerRecommendsFallback } from './components/BannerRecommends';
|
|
|
|
import PreviewBanner from './components/PreviewBanner';
|
2023-10-21 16:39:59 +08:00
|
|
|
import Group from './components/Group';
|
|
|
|
|
|
|
|
const ComponentsList = React.lazy(() => import('./components/ComponentsList'));
|
|
|
|
const DesignFramework = React.lazy(() => import('./components/DesignFramework'));
|
|
|
|
const Theme = React.lazy(() => import('./components/Theme'));
|
2023-02-03 13:39:46 +08:00
|
|
|
|
2023-07-20 19:27:33 +08:00
|
|
|
const useStyle = createStyles(() => ({
|
2023-02-03 13:39:46 +08:00
|
|
|
image: css`
|
|
|
|
position: absolute;
|
|
|
|
left: 0;
|
|
|
|
top: -50px;
|
|
|
|
height: 160px;
|
|
|
|
`,
|
2023-07-20 19:27:33 +08:00
|
|
|
}));
|
2022-11-09 12:28:04 +08:00
|
|
|
|
|
|
|
const locales = {
|
|
|
|
cn: {
|
|
|
|
assetsTitle: '组件丰富,选用自如',
|
|
|
|
assetsDesc: '大量实用组件满足你的需求,灵活定制与拓展',
|
|
|
|
designTitle: '设计语言与研发框架',
|
|
|
|
designDesc: '配套生态,让你快速搭建网站应用',
|
|
|
|
},
|
|
|
|
en: {
|
|
|
|
assetsTitle: 'Rich components',
|
|
|
|
assetsDesc: 'Practical components to meet your needs, flexible customization and expansion',
|
|
|
|
designTitle: 'Design and framework',
|
|
|
|
designDesc: 'Supporting ecology, allowing you to quickly build website applications',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2022-11-24 20:11:50 +08:00
|
|
|
const Homepage: React.FC = () => {
|
2022-11-24 15:41:45 +08:00
|
|
|
const [locale] = useLocale(locales);
|
2023-07-20 19:27:33 +08:00
|
|
|
const { styles } = useStyle();
|
2023-08-25 19:08:52 +08:00
|
|
|
const { token } = theme.useToken();
|
|
|
|
|
|
|
|
const isRootDark = useDark();
|
2022-11-09 12:28:04 +08:00
|
|
|
|
|
|
|
return (
|
2023-08-25 19:08:52 +08:00
|
|
|
<section>
|
|
|
|
<PreviewBanner>
|
|
|
|
{/* 文档很久没更新了,先藏起来 */}
|
|
|
|
{/* <Suspense fallback={<BannerRecommendsFallback />}>
|
|
|
|
<BannerRecommends />
|
|
|
|
</Suspense> */}
|
|
|
|
</PreviewBanner>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
{/* 定制主题 */}
|
|
|
|
<ConfigProvider
|
|
|
|
theme={{
|
|
|
|
algorithm: theme.defaultAlgorithm,
|
|
|
|
}}
|
|
|
|
>
|
2023-10-21 16:39:59 +08:00
|
|
|
<Suspense fallback={null}>
|
|
|
|
<Theme />
|
|
|
|
</Suspense>
|
2023-08-25 19:08:52 +08:00
|
|
|
</ConfigProvider>
|
|
|
|
|
|
|
|
{/* 组件列表 */}
|
|
|
|
<Group
|
|
|
|
background={token.colorBgElevated}
|
|
|
|
collapse
|
|
|
|
title={locale.assetsTitle}
|
|
|
|
description={locale.assetsDesc}
|
|
|
|
id="design"
|
|
|
|
>
|
2023-10-21 16:39:59 +08:00
|
|
|
<Suspense fallback={null}>
|
|
|
|
<ComponentsList />
|
|
|
|
</Suspense>
|
2023-08-25 19:08:52 +08:00
|
|
|
</Group>
|
|
|
|
|
|
|
|
{/* 设计语言 */}
|
|
|
|
<Group
|
|
|
|
title={locale.designTitle}
|
|
|
|
description={locale.designDesc}
|
|
|
|
background={isRootDark ? 'rgb(57, 63, 74)' : '#F5F8FF'}
|
|
|
|
decoration={
|
|
|
|
<img
|
|
|
|
className={styles.image}
|
|
|
|
src="https://gw.alipayobjects.com/zos/bmw-prod/ba37a413-28e6-4be4-b1c5-01be1a0ebb1c.svg"
|
|
|
|
alt=""
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
>
|
2023-10-21 16:39:59 +08:00
|
|
|
<Suspense fallback={null}>
|
|
|
|
<DesignFramework />
|
|
|
|
</Suspense>
|
2023-08-25 19:08:52 +08:00
|
|
|
</Group>
|
|
|
|
</div>
|
|
|
|
</section>
|
2022-11-09 12:28:04 +08:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Homepage;
|