-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Impl [Projects] New Menu and Project Page Revamp (#967)
https://jira.iguazeng.com/browse/ML-1583 https://jira.iguazeng.com/browse/ML-1377 * new Projects Menu quick links * Projects Cards Revamp
- Loading branch information
1 parent
a86259b
commit 1047696
Showing
89 changed files
with
2,329 additions
and
312 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import { createPortal } from 'react-dom' | ||
import { CSSTransition } from 'react-transition-group' | ||
|
||
import './Backdrop.scss' | ||
|
||
const Backdrop = ({ duration = 300, show, onClose }) => { | ||
return createPortal( | ||
<CSSTransition | ||
in={show} | ||
timeout={duration} | ||
classNames="backdrop-transition" | ||
mountOnEnter | ||
unmountOnExit | ||
> | ||
<div className="backdrop" onClick={onClose}></div> | ||
</CSSTransition>, | ||
document.getElementById('overlay_container') | ||
) | ||
} | ||
|
||
Backdrop.defaultProps = { | ||
duration: 300, | ||
show: false | ||
} | ||
|
||
Backdrop.propTypes = { | ||
show: PropTypes.bool.isRequired | ||
} | ||
|
||
export default Backdrop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.backdrop { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
z-index: 1; | ||
width: 100vw; | ||
height: 100vh; | ||
background-color: #000; | ||
|
||
&-transition { | ||
&-enter { | ||
opacity: 0; | ||
} | ||
|
||
&-enter-active, | ||
&-enter-done { | ||
opacity: 0.5; | ||
transition: opacity 0.3s ease-in-out; | ||
} | ||
|
||
&-exit { | ||
opacity: 0.5; | ||
} | ||
|
||
&-exit-active { | ||
opacity: 0; | ||
transition: opacity 0.3s ease-in-out; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import React, { useEffect, useState } from 'react' | ||
import PropTypes from 'prop-types' | ||
import { createPortal } from 'react-dom' | ||
import { CSSTransition } from 'react-transition-group' | ||
import classNames from 'classnames' | ||
|
||
import Backdrop from '../Backdrop.js/Backdrop' | ||
import RoundedIcon from '../RoundedIcon/RoundedIcon' | ||
|
||
import { ReactComponent as CloseIcon } from '../../images/close.svg' | ||
|
||
import './Modal.scss' | ||
|
||
const JSX_MODAL = ({ children, className, onClose, size, show, title }) => { | ||
const [isModalOpen, setIsModalOpen] = useState(false) | ||
|
||
const modalClassNames = classNames( | ||
'modal', | ||
className, | ||
size && `modal-${size}` | ||
) | ||
|
||
const handleOnClose = () => { | ||
setIsModalOpen(false) | ||
onClose() | ||
} | ||
|
||
useEffect(() => { | ||
setIsModalOpen(show) | ||
return () => { | ||
setIsModalOpen(false) | ||
} | ||
}, [show]) | ||
return ( | ||
<> | ||
<Backdrop onClose={handleOnClose} show={isModalOpen} /> | ||
<CSSTransition | ||
in={isModalOpen} | ||
timeout={300} | ||
classNames="modal-transition" | ||
unmountOnExit | ||
> | ||
<div className={modalClassNames} data-testid="modal"> | ||
<RoundedIcon | ||
className="modal__header-button" | ||
onClick={handleOnClose} | ||
tooltipText="Close" | ||
data-testid="pop-up-close-btn" | ||
> | ||
<CloseIcon /> | ||
</RoundedIcon> | ||
<div className="modal__content"> | ||
<div className="modal__header"> | ||
<h5 className="modal__header-title">{title}</h5> | ||
</div> | ||
<div className="modal__body">{children}</div> | ||
<div className="modal__footer"></div> | ||
</div> | ||
</div> | ||
</CSSTransition> | ||
</> | ||
) | ||
} | ||
const Modal = props => { | ||
return createPortal( | ||
<JSX_MODAL {...props} />, | ||
document.getElementById('overlay_container') | ||
) | ||
} | ||
|
||
Modal.defaultProps = { | ||
show: false, | ||
size: 'normal', | ||
title: '' | ||
} | ||
|
||
Modal.propTypes = { | ||
children: PropTypes.oneOfType([PropTypes.object, PropTypes.string]) | ||
.isRequired, | ||
onClose: PropTypes.func.isRequired, | ||
show: PropTypes.bool.isRequired, | ||
size: PropTypes.oneOf(['sm', 'normal', 'lg']), | ||
title: PropTypes.string | ||
} | ||
|
||
export default Modal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
@import '../../scss/variables'; | ||
@import '../../scss/colors'; | ||
@import '../../scss/borders'; | ||
|
||
.modal { | ||
position: fixed; | ||
top: 30%; | ||
max-width: 600px; | ||
width: 100%; | ||
outline: 0; | ||
z-index: 2; | ||
|
||
&-sm { | ||
max-width: 400px; | ||
} | ||
|
||
&-lg { | ||
max-width: 800px; | ||
} | ||
|
||
&__content { | ||
display: flex; | ||
flex-flow: column nowrap; | ||
position: relative; | ||
min-height: 300px; | ||
height: calc(100% - 3.5rem); | ||
max-height: 90vh; | ||
background-color: $white; | ||
border-radius: $mainBorderRadius; | ||
box-shadow: 0 6px 26px rgba($black, 0.2); | ||
overflow: hidden; | ||
text-align: center; | ||
} | ||
|
||
&__header { | ||
position: relative; | ||
padding: 2rem; | ||
display: flex; | ||
flex-shrink: 0; | ||
justify-content: center; | ||
align-items: center; | ||
border-bottom: $primaryBorder; | ||
|
||
&-title { | ||
color: $primary; | ||
font-size: 2em; | ||
margin: 0; | ||
} | ||
&-button { | ||
position: absolute; | ||
top: 7px; | ||
right: 2px; | ||
} | ||
} | ||
|
||
&__body { | ||
overflow-y: auto; | ||
overflow-x: hidden; | ||
flex: 1 1 auto; | ||
} | ||
|
||
&__footer { | ||
flex-shrink: 0; | ||
} | ||
|
||
&-transition { | ||
&-enter { | ||
opacity: 0; | ||
transform: translateY(calc(100vh)); | ||
transition: all 0.3s ease-in-out; | ||
} | ||
|
||
&-enter-active, | ||
&-enter-done { | ||
opacity: 1; | ||
transform: translateY(-30%); | ||
} | ||
|
||
&-exit { | ||
opacity: 1; | ||
transform: translateY(-30%); | ||
} | ||
|
||
&-exit-active { | ||
opacity: 0; | ||
top: 20%; | ||
transition: all 0.3s ease-in-out; | ||
} | ||
} | ||
} |
Oops, something went wrong.