mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
added new flow presets
This commit is contained in:
parent
4e5a6d727a
commit
5cd1064140
18 changed files with 64 additions and 45 deletions
|
@ -2,7 +2,7 @@ import React, { FC, useCallback, useEffect, useRef, useState } from 'react';
|
|||
|
||||
import classNames from 'classnames';
|
||||
|
||||
import { PRESETS } from '~/constants/urls';
|
||||
import { ImagePresets } from '~/constants/urls';
|
||||
import { IUser } from '~/types/auth';
|
||||
import { getURL } from '~/utils/dom';
|
||||
|
||||
|
@ -19,14 +19,14 @@ const CoverBackdrop: FC<IProps> = ({ cover }) => {
|
|||
|
||||
const onLoad = useCallback(() => setIsLoaded(true), [setIsLoaded]);
|
||||
|
||||
const image = getURL(cover, PRESETS.cover);
|
||||
const image = getURL(cover, ImagePresets.cover);
|
||||
|
||||
useEffect(() => {
|
||||
if (!cover || !cover.url || !ref || !ref.current) return;
|
||||
|
||||
ref.current.src = '';
|
||||
setIsLoaded(false);
|
||||
ref.current.src = getURL(cover, PRESETS.cover);
|
||||
ref.current.src = getURL(cover, ImagePresets.cover);
|
||||
}, [cover]);
|
||||
|
||||
if (!cover) return null;
|
||||
|
|
|
@ -2,7 +2,7 @@ import React, { createContext, FC, useContext, useState } from 'react';
|
|||
|
||||
import { createPortal } from 'react-dom';
|
||||
|
||||
import { PRESETS } from '~/constants/urls';
|
||||
import { ImagePresets } from '~/constants/urls';
|
||||
import { IFile } from '~/types';
|
||||
import { getURL } from '~/utils/dom';
|
||||
|
||||
|
@ -27,7 +27,7 @@ const PageCoverProvider: FC = ({ children }) => {
|
|||
createPortal(
|
||||
<div
|
||||
className={styles.wrap}
|
||||
style={{ backgroundImage: `url("${getURL(cover, PRESETS.cover)}")` }}
|
||||
style={{ backgroundImage: `url("${getURL(cover, ImagePresets.cover)}")` }}
|
||||
/>,
|
||||
document.body
|
||||
)}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue