* LayoutPortal установлен как memo

* LayoutPortalProps расширен с LayoutProps
* тип заголовка изменён на ReactNode
* добавлен экспорт LayoutPortalProps
* добавлен экспорт по-умолчанию
This commit is contained in:
Александр Сироткин 2022-01-12 23:46:07 +05:00
parent d92ba25089
commit 702e994e64
3 changed files with 21 additions and 12 deletions

View File

@ -1,13 +1,14 @@
import { Button, Layout } from 'antd'
import { memo, ReactNode } from 'react'
import { Link } from 'react-router-dom'
import { Button, Layout, LayoutProps } from 'antd'
import PageHeader from '../PageHeader'
type LayoutPortalProps = {
title?: string
[props: string]: any
export type AdminLayoutPortalProps = LayoutProps & {
title?: ReactNode
}
export const AdminLayoutPortal: React.FC<LayoutPortalProps> = ({title, ...props}) => (
export const AdminLayoutPortal = memo<AdminLayoutPortalProps>(({ title, ...props }) => (
<Layout.Content>
<PageHeader isAdmin title={title} style={{ backgroundColor: '#900' }}>
<Button size={'large'}>
@ -18,4 +19,6 @@ export const AdminLayoutPortal: React.FC<LayoutPortalProps> = ({title, ...props}
<Layout.Content className={'site-layout-background sheet'} {...props}/>
</Layout>
</Layout.Content>
)
))
export default AdminLayoutPortal

View File

@ -1,14 +1,15 @@
import { Layout } from 'antd'
import { memo, ReactNode } from 'react'
import { Layout, LayoutProps } from 'antd'
import PageHeader from '../PageHeader'
import WellTreeSelector from '../WellTreeSelector'
type LayoutPortalProps = {
title?: string
export type LayoutPortalProps = LayoutProps & {
title?: ReactNode
noSheet?: boolean
[props: string]: any
}
export const LayoutPortal: React.FC<LayoutPortalProps> = ({title, noSheet, ...props}) => (
export const LayoutPortal = memo<LayoutPortalProps>(({ title, noSheet, ...props }) => (
<Layout.Content>
<PageHeader title={title}>
<WellTreeSelector />
@ -19,4 +20,6 @@ export const LayoutPortal: React.FC<LayoutPortalProps> = ({title, noSheet, ...pr
)}
</Layout>
</Layout.Content>
)
))
export default LayoutPortal

View File

@ -1,2 +1,5 @@
export { AdminLayoutPortal } from './AdminLayoutPortal'
export { LayoutPortal } from './LayoutPortal'
export type { AdminLayoutPortalProps } from './AdminLayoutPortal'
export type { LayoutPortalProps } from './LayoutPortal'