mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
universal backdrop component
This commit is contained in:
parent
327272a08a
commit
f781ecc6aa
4 changed files with 6 additions and 4 deletions
|
@ -9,7 +9,7 @@ interface IProps {
|
||||||
cover: IUser['cover'];
|
cover: IUser['cover'];
|
||||||
}
|
}
|
||||||
|
|
||||||
const ProfileBackdrop: FC<IProps> = ({ cover }) => {
|
const CoverBackdrop: FC<IProps> = ({ cover }) => {
|
||||||
const [is_loaded, setIsLoaded] = useState(false);
|
const [is_loaded, setIsLoaded] = useState(false);
|
||||||
|
|
||||||
const onLoad = useCallback(() => setIsLoaded(true), [setIsLoaded]);
|
const onLoad = useCallback(() => setIsLoaded(true), [setIsLoaded]);
|
||||||
|
@ -32,4 +32,4 @@ const ProfileBackdrop: FC<IProps> = ({ cover }) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export { ProfileBackdrop };
|
export { CoverBackdrop };
|
|
@ -15,6 +15,7 @@ import { selectUploads } from '~/redux/uploads/selectors';
|
||||||
import { ERROR_LITERAL } from '~/constants/errors';
|
import { ERROR_LITERAL } from '~/constants/errors';
|
||||||
import { NODE_EDITORS, EMPTY_NODE } from '~/redux/node/constants';
|
import { NODE_EDITORS, EMPTY_NODE } from '~/redux/node/constants';
|
||||||
import { BetterScrollDialog } from '../BetterScrollDialog';
|
import { BetterScrollDialog } from '../BetterScrollDialog';
|
||||||
|
import { CoverBackdrop } from '~/components/containers/CoverBackdrop';
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
const { editor, errors } = selectNode(state);
|
const { editor, errors } = selectNode(state);
|
||||||
|
@ -93,6 +94,7 @@ const EditorDialogUnconnected: FC<IProps> = ({
|
||||||
<form onSubmit={onSubmit} className={styles.form}>
|
<form onSubmit={onSubmit} className={styles.form}>
|
||||||
<BetterScrollDialog
|
<BetterScrollDialog
|
||||||
footer={buttons}
|
footer={buttons}
|
||||||
|
backdrop={<CoverBackdrop cover={data.cover} />}
|
||||||
width={860}
|
width={860}
|
||||||
error={error && ERROR_LITERAL[error]}
|
error={error && ERROR_LITERAL[error]}
|
||||||
onClose={onRequestClose}
|
onClose={onRequestClose}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { ProfileDescription } from '~/components/profile/ProfileDescription';
|
||||||
import * as AUTH_ACTIONS from '~/redux/auth/actions';
|
import * as AUTH_ACTIONS from '~/redux/auth/actions';
|
||||||
import { IAuthState } from '~/redux/auth/types';
|
import { IAuthState } from '~/redux/auth/types';
|
||||||
import pick from 'ramda/es/pick';
|
import pick from 'ramda/es/pick';
|
||||||
import { ProfileBackdrop } from '~/components/profile/ProfileBackdrop';
|
import { CoverBackdrop } from '~/components/containers/CoverBackdrop';
|
||||||
|
|
||||||
const TAB_CONTENT = {
|
const TAB_CONTENT = {
|
||||||
profile: <ProfileDescription />,
|
profile: <ProfileDescription />,
|
||||||
|
@ -49,7 +49,7 @@ const ProfileDialogUnconnected: FC<IProps> = ({
|
||||||
setTab={setTab}
|
setTab={setTab}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
backdrop={<ProfileBackdrop cover={user && user.cover} />}
|
backdrop={<CoverBackdrop cover={user && user.cover} />}
|
||||||
onClose={onRequestClose}
|
onClose={onRequestClose}
|
||||||
>
|
>
|
||||||
{TAB_CONTENT[tab] || null}
|
{TAB_CONTENT[tab] || null}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue