Код LayoutPortal сокоращён и дополнен

This commit is contained in:
goodmice 2021-10-19 14:50:32 +05:00
parent f79c96f3c0
commit 1bd13aab97
2 changed files with 11 additions and 18 deletions

View File

@ -1,20 +1,13 @@
import {Layout} from 'antd' import {Layout} from 'antd'
import PageHeader from './PageHeader' import PageHeader from './PageHeader'
const {Content} = Layout export const LayoutPortal = ({title, noSheet, ...props}) => (
<Layout.Content>
export default function LayoutPortal({title, noSheet, children}) { <PageHeader title={title}/>
const content = noSheet <Layout>
? <Layout>{children}</Layout> {noSheet ? props.children : (
: <Layout> <Layout.Content className={'site-layout-background sheet'} {...props}/>
<Content className="site-layout-background sheet"> )}
{children} </Layout>
</Content> </Layout.Content>
</Layout> )
return (
<Content>
<PageHeader title={title}/>
{content}
</Content>)
}

View File

@ -2,7 +2,7 @@ import { Redirect, Route, Switch } from "react-router-dom";
import Deposit from "./Deposit"; import Deposit from "./Deposit";
import Cluster from "./Cluster"; import Cluster from "./Cluster";
import Well from "./Well"; import Well from "./Well";
import LayoutPortal from "../components/LayoutPortal"; import {LayoutPortal} from "../components/LayoutPortal";
export default function Main() { export default function Main() {
return ( return (