mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
tidy syntax
This commit is contained in:
parent
33ce3be72f
commit
043c2790d9
1 changed files with 5 additions and 7 deletions
|
|
@ -6,15 +6,13 @@ interface TablePageSize {
|
|||
}
|
||||
|
||||
export const useTablePageSizer = () => {
|
||||
const calculateSize = () => {
|
||||
return {
|
||||
pageSize: Math.floor((window.innerHeight - 211.5) / 56),
|
||||
isNarrowWindow: window.innerWidth < 576 ? true : false
|
||||
};
|
||||
}
|
||||
const calculateSize = () => ({
|
||||
pageSize: Math.floor((window.innerHeight - 211.5) / 56),
|
||||
isNarrowWindow: window.innerWidth < 576 ? true : false
|
||||
});
|
||||
const [state, setState] = useState<TablePageSize>(calculateSize());
|
||||
useEffect(() => {
|
||||
const updatePageSize = () => { setState(calculateSize()) }
|
||||
const updatePageSize = () => setState(calculateSize())
|
||||
window.addEventListener('resize', updatePageSize);
|
||||
return () => window.removeEventListener('resize', updatePageSize);
|
||||
}, []);
|
||||
|
|
|
|||
Loading…
Reference in a new issue