new LoadPortal component

This commit is contained in:
Фролов 2021-06-01 15:28:05 +05:00
parent 3b763d9a74
commit 67bd18e43c
2 changed files with 18 additions and 4 deletions

View File

@ -0,0 +1,13 @@
import Loader from './Loader'
export default function LoaderPortal({show, children}){
return(
<div className='loader-container'>
<div className='loader-content'>
123456{/* {children} */}
</div>
{/* {show && <div className='loader-overlay'><Loader/></div>} */}
<div className='loader-overlay'>qqqq</div>
{/* {show && <Loader className='loader-overlay'/>} */}
</div>)
}

View File

@ -1,6 +1,6 @@
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
import { WellService } from '../services/api' import { WellService } from '../services/api'
import Loader from '../components/Loader' import LoaderPortal from '../components/LoaderPortal'
import { Table } from 'antd' // TreeSelect import { Table } from 'antd' // TreeSelect
import { useHistory } from 'react-router-dom' import { useHistory } from 'react-router-dom'
import notify from '../components/notify' import notify from '../components/notify'
@ -44,13 +44,14 @@ export default function Wells(props){
notify('Не удалось загрузить список скважин', 'error') notify('Не удалось загрузить список скважин', 'error')
console.error(`${e}`); console.error(`${e}`);
} }
setLoader(false) //setLoader(false)
} }
useEffect(()=>updateWellsList(), []) useEffect(()=>updateWellsList(), [])
return(<> return(<>
<h2>Скважины</h2> <h2>Скважины</h2>
<LoaderPortal show={loader}>
<Table <Table
dataSource={wells} dataSource={wells}
columns={columns} columns={columns}
@ -59,6 +60,6 @@ export default function Wells(props){
onClick: event => {history.push(`/well/${record.id}/`)}, onClick: event => {history.push(`/well/${record.id}/`)},
}; };
}}/> }}/>
{loader&&<Loader/>} </LoaderPortal>
</>) </>)
} }