1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-28 14:16:41 +07:00

floating node panel

This commit is contained in:
Fedor Katurov 2019-10-13 21:11:20 +07:00
parent 9e25b4e2b0
commit 336582b3d6
7 changed files with 200 additions and 113 deletions

View file

@ -18,9 +18,11 @@ import { UPLOAD_TYPES } from '~/redux/uploads/constants';
interface IProps {
is_loading: boolean;
node: INode;
layout: {};
updateLayout: () => void;
}
const NodeImageBlock: FC<IProps> = ({ node, is_loading }) => {
const NodeImageBlock: FC<IProps> = ({ node, is_loading, updateLayout }) => {
const [is_animated, setIsAnimated] = useState(false);
const [current, setCurrent] = useState(0);
const [height, setHeight] = useState(320);
@ -39,6 +41,8 @@ const NodeImageBlock: FC<IProps> = ({ node, is_loading }) => {
loaded,
]);
useEffect(() => updateLayout(), [loaded]);
useEffect(() => {
if (!refs || !refs.current[current] || !loaded[current]) return setHeight(320);