1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-05-01 07:36:40 +07:00

fixed switcher appearance

This commit is contained in:
Fedor Katurov 2020-04-23 14:12:43 +07:00
parent b385df297a
commit 511a8b5768
3 changed files with 9 additions and 8 deletions
src/components/node/NodeImageBlock

View file

@ -20,7 +20,7 @@ interface IProps {
const NodeImageBlock: FC<IProps> = ({ node, is_loading, updateLayout, modalShowPhotoswipe }) => {
const [is_animated, setIsAnimated] = useState(false);
const [current, setCurrent] = useState(0);
const [height, setHeight] = useState(window.innerHeight - 140);
const [height, setHeight] = useState(window.innerHeight - 150);
const [loaded, setLoaded] = useState<Record<number, boolean>>({});
const refs = useRef<Record<number, HTMLDivElement>>({});
@ -41,7 +41,7 @@ const NodeImageBlock: FC<IProps> = ({ node, is_loading, updateLayout, modalShowP
useEffect(() => {
if (!refs || !refs.current[current] || !loaded[current])
return setHeight(window.innerHeight - 140);
return setHeight(window.innerHeight - 150);
const el = refs.current[current];
const element_height = el.getBoundingClientRect && el.getBoundingClientRect().height;