Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#758 [FE] Prevent modal from closing when clicking outside of it #760

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const DeleteProfilePage = (props) => {
<button className={css['button__delete']} onClick={() => setModal(true)}>
Видалити
</button>
<MyModal visible={modal} setVisisble={setModal}>
<MyModal visible={modal}>
<DeleteProfileModal onCancel={cancelHandler} />
</MyModal>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ const ProfileContent = (props) => {

{blocker.state === 'blocked' &&
(
<MyModal visible={modal} setVisisble={setModal}>
<MyModal visible={modal}>
<WarnUnsavedDataModal onCancel={cancelNavigation} onConfirm={confirmNavigation} />
</MyModal>)
}
Expand Down
4 changes: 2 additions & 2 deletions FrontEnd/src/components/ProfilePage/UI/MyModal/MyModal.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import css from './MyModal.module.css';

const MyModal = ({children, visible, setVisisble}) => {
const MyModal = ({children, visible}) => {
const rootClasses = [css['myModal']];
if (visible) {
rootClasses.push(css['active']);
}

return (
<div className={rootClasses.join(' ')} onClick={() => setVisisble(false)}>
<div className={rootClasses.join(' ')}>
<div className={css['myModal__content']} onClick={(event) => event.stopPropagation()}>{children}</div>
</div>
);
Expand Down
1 change: 0 additions & 1 deletion FrontEnd/src/components/cookieacception/CookieMod.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const CookieMod = ({ active, setActive }) => {
return cookies.first ? null : (
<div
className={`${styles['modal-window']} ${active && styles['active']}`}
onClick={() => setActive(false)}
>
<div className={styles['modal-content']} data-testid="cookiemodal" onClick={(e) => e.stopPropagation()}>
<p className={styles['cookie-text']}>
Expand Down
2 changes: 1 addition & 1 deletion FrontEnd/src/components/moderation/ModerationModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function ModerationModal() {
return (
<div>
<MainPage />
<MyModal visible={modalVisible} setVisisble={setModalVisible}>
<MyModal visible={modalVisible}>
<div className={classes['modal__content']}>{moderationStatus}</div>
<div className={classes['modal__footer']}>
<div className={classes['button-container']}>
Expand Down
Loading