Код 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 PageHeader from './PageHeader'
const {Content} = Layout
export default function LayoutPortal({title, noSheet, children}) {
const content = noSheet
? <Layout>{children}</Layout>
: <Layout>
<Content className="site-layout-background sheet">
{children}
</Content>
</Layout>
return (
<Content>
<PageHeader title={title}/>
{content}
</Content>)
}
export const LayoutPortal = ({title, noSheet, ...props}) => (
<Layout.Content>
<PageHeader title={title}/>
<Layout>
{noSheet ? props.children : (
<Layout.Content className={'site-layout-background sheet'} {...props}/>
)}
</Layout>
</Layout.Content>
)

View File

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