refactor: Clean up MinAppsPopover component formatting
This commit is contained in:
parent
40912eaaf4
commit
09a8f83650
@ -4,7 +4,7 @@ import App from '@renderer/pages/apps/App'
|
|||||||
import { Popover } from 'antd'
|
import { Popover } from 'antd'
|
||||||
import { Empty } from 'antd'
|
import { Empty } from 'antd'
|
||||||
import { isEmpty } from 'lodash'
|
import { isEmpty } from 'lodash'
|
||||||
import { FC, useState, useEffect } from 'react'
|
import { FC, useEffect, useState } from 'react'
|
||||||
import { useHotkeys } from 'react-hotkeys-hook'
|
import { useHotkeys } from 'react-hotkeys-hook'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
|
|
||||||
@ -26,19 +26,19 @@ const MinAppsPopover: FC<Props> = ({ children }) => {
|
|||||||
setOpen(false)
|
setOpen(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
const [maxHeight, setMaxHeight] = useState(window.innerHeight - 100);
|
const [maxHeight, setMaxHeight] = useState(window.innerHeight - 100)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleResize = () => {
|
const handleResize = () => {
|
||||||
setMaxHeight(window.innerHeight - 100);
|
setMaxHeight(window.innerHeight - 100)
|
||||||
};
|
}
|
||||||
|
|
||||||
window.addEventListener('resize', handleResize);
|
window.addEventListener('resize', handleResize)
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
window.removeEventListener('resize', handleResize);
|
window.removeEventListener('resize', handleResize)
|
||||||
};
|
}
|
||||||
}, []);
|
}, [])
|
||||||
|
|
||||||
const content = (
|
const content = (
|
||||||
<PopoverContent maxHeight={maxHeight}>
|
<PopoverContent maxHeight={maxHeight}>
|
||||||
@ -74,9 +74,9 @@ const PopoverContent = styled(Scrollbar)<{ maxHeight: number }>`
|
|||||||
`
|
`
|
||||||
|
|
||||||
const AppsContainer = styled.div`
|
const AppsContainer = styled.div`
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(6, minmax(90px, 1fr));
|
grid-template-columns: repeat(6, minmax(90px, 1fr));
|
||||||
gap: 18px;
|
gap: 18px;
|
||||||
`;
|
`
|
||||||
|
|
||||||
export default MinAppsPopover
|
export default MinAppsPopover
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user