Skip to content

Commit

Permalink
Merge pull request #760 from ita-social-projects/#758-FEPreventModalF…
Browse files Browse the repository at this point in the history
…romClosingWhenClickingOutsideOfIt

#758 [FE] Prevent modal from closing when clicking outside of it
  • Loading branch information
Lvyshnevska authored Sep 4, 2024
2 parents e0aec70 + 4847301 commit 73cad18
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
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

0 comments on commit 73cad18

Please sign in to comment.