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

EPMRPP-77676 || Add animations for opening/closing modal windows (redesigned modals only) #3369

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
132 changes: 126 additions & 6 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"downshift": "6.1.7",
"fast-deep-equal": "2.0.1",
"fetch-jsonp": "1.1.3",
"framer-motion": "6.5.1",
"history": "4.7.2",
"html-react-parser": "1.2.4",
"intl": "1.2.5",
Expand Down
44 changes: 22 additions & 22 deletions app/src/componentLibrary/modal/modalLayout/modalLayout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import React, { useEffect, useRef, useState } from 'react';
import PropTypes from 'prop-types';
import { Scrollbars } from 'react-custom-scrollbars';
import { CSSTransition } from 'react-transition-group';
import { motion, AnimatePresence } from 'framer-motion';
import classNames from 'classnames/bind';
import { useOnClickOutside } from 'common/hooks';
import { ModalContent } from './modalContent';
Expand Down Expand Up @@ -67,38 +67,38 @@ export const ModalLayout = ({
useOnClickOutside(modalRef, allowCloseOutside && closeModal);

return (
<div
className={cx('modal-layout', { [`overlay-${overlay}`]: overlay })}
data-automation-id="modalWindow"
>
<div className={cx('scrolling-content')}>
<Scrollbars>
<CSSTransition
timeout={300}
in={isShown}
classNames={cx('modal-window-animation')}
onExited={onClose}
>
{(status) => (
<div
<AnimatePresence onExitComplete={onClose}>
{isShown && (
<div
className={cx('modal-layout', { [`overlay-${overlay}`]: overlay })}
data-automation-id="modalWindow"
>
<div className={cx('scrolling-content')}>
<Scrollbars>
<motion.div
className={cx('modal-window', { [`size-${modalSize}`]: modalSize }, className)}
key="modal-window"
ref={modalRef}
tabIndex="0"
initial={{ opacity: 0, marginTop: '-100px' }}
animate={{ opacity: 1, marginTop: '80px' }}
exit={{ opacity: 0, marginTop: '-100px' }}
transition={{ duration: 0.3 }}
>
<ModalHeader title={title} headerNode={headerNode} onClose={closeModal} />
<ModalContent>{status !== 'exited' ? children : null}</ModalContent>
<ModalContent>{children}</ModalContent>
<ModalFooter
footerNode={footerNode}
okButton={okButton}
cancelButton={cancelButton}
closeHandler={closeModal}
/>
</div>
)}
</CSSTransition>
</Scrollbars>
</div>
</div>
</motion.div>
</Scrollbars>
</div>
</div>
)}
</AnimatePresence>
);
};
ModalLayout.propTypes = {
Expand Down
24 changes: 0 additions & 24 deletions app/src/componentLibrary/modal/modalLayout/modalLayout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,34 +48,11 @@ $Z-INDEX-OVERLAY: 2;
z-index: $Z-INDEX-OVERLAY;
}

:global {
.modal-window-animation-enter {
opacity: 0;
margin-top: -100px;
}

.modal-window-animation-enter-active {
opacity: 1;
margin-top: 80px;
}

.modal-window-animation-exit {
opacity: 1;
margin-top: 80px;
}

.modal-window-animation-exit-active {
opacity: 0;
margin-top: -100px;
}
}

.modal-window {
position: absolute;
left: 50%;
transform: translate(-50%);
display: inline-block;
margin-top: 80px;
margin-bottom: 10px;
padding: 32px 48px;
box-sizing: border-box;
Expand All @@ -84,7 +61,6 @@ $Z-INDEX-OVERLAY: 2;
border-radius: 16px;
box-shadow: $BOX_SHADOW--modal-window;
opacity: 1;
transition: margin-top 300ms ease-in, opacity 300ms ease-in;
outline: none;
}

Expand Down
2 changes: 1 addition & 1 deletion app/webpack/base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ module.exports = {
new webpack.ProvidePlugin({
React: 'react',
Utils: 'common/utils',
process: 'process/browser',
process: 'process/browser.js',
Buffer: ['buffer', 'Buffer'],
}),
new ModuleFederationPlugin({
Expand Down