mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
#58 made dialogs as routes
This commit is contained in:
parent
d9af895558
commit
4dc8bea040
21 changed files with 230 additions and 172 deletions
19
src/components/dialogs/ModalWrapper/index.tsx
Normal file
19
src/components/dialogs/ModalWrapper/index.tsx
Normal file
|
@ -0,0 +1,19 @@
|
|||
import React, { FC, MouseEventHandler } from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import styles from './styles.module.scss';
|
||||
|
||||
type IProps = {
|
||||
onOverlayClick: MouseEventHandler;
|
||||
};
|
||||
|
||||
const ModalWrapper: FC<IProps> = ({ children, onOverlayClick }) => {
|
||||
return ReactDOM.createPortal(
|
||||
<div className={styles.fixed}>
|
||||
<div className={styles.overlay} onClick={onOverlayClick} />
|
||||
<div className={styles.content}>{children}</div>
|
||||
</div>,
|
||||
document.body
|
||||
);
|
||||
};
|
||||
|
||||
export { ModalWrapper };
|
Loading…
Add table
Add a link
Reference in a new issue