web: React18+TDesign 网页控制台(登录/工作台/素材/账号/任务/审核/挑战/通知/审计/成员/设置/admin)
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import { useAppDispatch, useAppSelector } from '../../modules/store';
|
||||
import { selectGlobal, switchFullPage } from '../../modules/global';
|
||||
import { Layout, Breadcrumb } from 'tdesign-react';
|
||||
import Style from './Page.module.less';
|
||||
|
||||
const { Content } = Layout;
|
||||
const { BreadcrumbItem } = Breadcrumb;
|
||||
|
||||
const Page = ({
|
||||
children,
|
||||
isFullPage,
|
||||
breadcrumbs,
|
||||
}: React.PropsWithChildren<{ isFullPage?: boolean; breadcrumbs?: string[] }>) => {
|
||||
const globalState = useAppSelector(selectGlobal);
|
||||
const dispatch = useAppDispatch();
|
||||
useEffect(() => {
|
||||
dispatch(switchFullPage(isFullPage));
|
||||
}, [isFullPage]);
|
||||
|
||||
if (isFullPage) {
|
||||
return <>{children}</>;
|
||||
}
|
||||
|
||||
return (
|
||||
<Content className={Style.panel}>
|
||||
{globalState.showBreadcrumbs && (
|
||||
<Breadcrumb className={Style.breadcrumb}>
|
||||
{breadcrumbs?.map((item, index) => (
|
||||
<BreadcrumbItem key={index}>{item}</BreadcrumbItem>
|
||||
))}
|
||||
</Breadcrumb>
|
||||
)}
|
||||
{children}
|
||||
</Content>
|
||||
);
|
||||
};
|
||||
|
||||
export default React.memo(Page);
|
||||
Reference in New Issue
Block a user