2023-02-03 13:39:46 +08:00
|
|
|
import { css } from '@emotion/react';
|
2022-11-30 11:05:41 +08:00
|
|
|
import { ConfigProvider } from 'antd';
|
2023-02-03 13:39:46 +08:00
|
|
|
import { useLocale as useDumiLocale } from 'dumi';
|
|
|
|
import React from 'react';
|
2022-11-09 12:28:04 +08:00
|
|
|
import useLocale from '../../hooks/useLocale';
|
|
|
|
import Banner from './components/Banner';
|
|
|
|
import BannerRecommends from './components/BannerRecommends';
|
|
|
|
import ComponentsList from './components/ComponentsList';
|
|
|
|
import DesignFramework from './components/DesignFramework';
|
2023-02-03 13:39:46 +08:00
|
|
|
import Group from './components/Group';
|
|
|
|
import Theme from './components/Theme';
|
|
|
|
import { useSiteData } from './components/util';
|
|
|
|
|
|
|
|
const useStyle = () => ({
|
|
|
|
image: css`
|
|
|
|
position: absolute;
|
|
|
|
left: 0;
|
|
|
|
top: -50px;
|
|
|
|
height: 160px;
|
|
|
|
`,
|
|
|
|
});
|
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);
|
2022-11-09 12:28:04 +08:00
|
|
|
const { id: localeId } = useDumiLocale();
|
|
|
|
const localeStr = localeId === 'zh-CN' ? 'cn' : 'en';
|
2023-02-03 13:39:46 +08:00
|
|
|
const { image } = useStyle();
|
2022-11-30 11:05:41 +08:00
|
|
|
const [siteData] = useSiteData();
|
2022-11-09 12:28:04 +08:00
|
|
|
|
|
|
|
return (
|
|
|
|
<ConfigProvider theme={{ algorithm: undefined }}>
|
2022-12-19 11:42:41 +08:00
|
|
|
<section>
|
|
|
|
<Banner>
|
|
|
|
<BannerRecommends extras={siteData?.extras?.[localeStr]} icons={siteData?.icons} />
|
|
|
|
</Banner>
|
|
|
|
<div>
|
|
|
|
<Theme />
|
|
|
|
<Group
|
|
|
|
background="#fff"
|
|
|
|
collapse
|
|
|
|
title={locale.assetsTitle}
|
|
|
|
description={locale.assetsDesc}
|
|
|
|
id="design"
|
|
|
|
>
|
|
|
|
<ComponentsList />
|
|
|
|
</Group>
|
|
|
|
<Group
|
|
|
|
title={locale.designTitle}
|
|
|
|
description={locale.designDesc}
|
|
|
|
background="#F5F8FF"
|
|
|
|
decoration={
|
2023-02-03 13:39:46 +08:00
|
|
|
<img
|
|
|
|
css={image}
|
|
|
|
src="https://gw.alipayobjects.com/zos/bmw-prod/ba37a413-28e6-4be4-b1c5-01be1a0ebb1c.svg"
|
|
|
|
alt=""
|
|
|
|
/>
|
2022-12-19 11:42:41 +08:00
|
|
|
}
|
|
|
|
>
|
|
|
|
<DesignFramework />
|
|
|
|
</Group>
|
|
|
|
</div>
|
|
|
|
</section>
|
2022-11-09 12:28:04 +08:00
|
|
|
</ConfigProvider>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Homepage;
|