mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-31 02:26:50 +10:00
Modal should be able to get classes for content
This commit is contained in:
parent
f7849a58fc
commit
3e79b949d6
3 changed files with 21 additions and 4 deletions
|
|
@ -43,6 +43,7 @@ export class ModalComponent extends Component {
|
|||
const {
|
||||
children,
|
||||
className,
|
||||
contentClassName,
|
||||
intl,
|
||||
isClosedClassName,
|
||||
isOpen,
|
||||
|
|
@ -65,7 +66,7 @@ export class ModalComponent extends Component {
|
|||
return (
|
||||
<div className={classes}>
|
||||
{closeBtn}
|
||||
<div className={css.content}>
|
||||
<div className={classNames(css.content, contentClassName)}>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -75,7 +76,8 @@ export class ModalComponent extends Component {
|
|||
|
||||
ModalComponent.defaultProps = {
|
||||
children: null,
|
||||
className: '',
|
||||
className: null,
|
||||
contentClassName: null,
|
||||
isClosedClassName: css.isClosed,
|
||||
isOpen: false,
|
||||
onClose: null,
|
||||
|
|
@ -86,6 +88,7 @@ const { bool, func, node, string } = PropTypes;
|
|||
ModalComponent.propTypes = {
|
||||
children: node,
|
||||
className: string,
|
||||
contentClassName: string,
|
||||
id: string.isRequired,
|
||||
intl: intlShape.isRequired,
|
||||
isClosedClassName: string,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,20 @@
|
|||
@import '../../marketplace.css';
|
||||
|
||||
/* ModalInMobile is visible by default */
|
||||
.modalInMobile { }
|
||||
.root {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Content is hidden in Mobile layout */
|
||||
.modalHidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.modalContent {
|
||||
@media (--viewportMedium) {
|
||||
height: 100%;
|
||||
|
||||
/* ModalInMobile content should work with box-shadows etc. */
|
||||
overflow: visible;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,11 +85,12 @@ class ModalInMobile extends Component {
|
|||
// - mobile layout: content visible inside modal popup
|
||||
// - mobile layout: content hidden
|
||||
const closedClassName = isClosedInMobile ? css.modalHidden : null;
|
||||
const classes = classNames({ [css.modalInMobile]: isOpenInMobile }, className);
|
||||
const classes = classNames({ [css.modalInMobile]: isOpenInMobile }, css.root, className);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
className={classes}
|
||||
contentClassName={css.modalContent}
|
||||
id={id}
|
||||
isOpen={isOpenInMobile}
|
||||
isClosedClassName={closedClassName}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue