mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
ui-bootstrap: Add Modal component.
This commit is contained in:
parent
0bc0000cb9
commit
290b3c7ed3
2 changed files with 37 additions and 0 deletions
36
packages/vulcan-ui-bootstrap/lib/components/ui/Modal.jsx
Normal file
36
packages/vulcan-ui-bootstrap/lib/components/ui/Modal.jsx
Normal file
|
@ -0,0 +1,36 @@
|
|||
import { registerComponent } from 'meteor/vulcan:lib';
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import Modal from 'react-bootstrap/lib/Modal'
|
||||
|
||||
const BootstrapModal = ({ children, size, show, onHide, title, showCloseButton, footerContent, ...rest }) => {
|
||||
|
||||
const header = title ? <Modal.Header closeButton={showCloseButton}><Modal.Title>{title}</Modal.Title></Modal.Header> : showCloseButton ? <Modal.Header closeButton={showCloseButton}></Modal.Header> : null;
|
||||
const footer = footerContent ? <Modal.Footer>{footerContent}</Modal.Footer> : null;
|
||||
return (
|
||||
<Modal bsSize={size} show={show} onHide={onHide} {...rest}>
|
||||
{header}
|
||||
<Modal.Body>
|
||||
{children}
|
||||
</Modal.Body>
|
||||
{footer}
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
BootstrapModal.propTypes = {
|
||||
size: PropTypes.string,
|
||||
show: PropTypes.bool,
|
||||
showCloseButton: PropTypes.bool,
|
||||
onHide: PropTypes.func,
|
||||
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
||||
footerContent: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
||||
}
|
||||
|
||||
BootstrapModal.defaultProps = {
|
||||
size: 'large',
|
||||
show: false,
|
||||
showCloseButton: true,
|
||||
}
|
||||
|
||||
registerComponent('Modal', BootstrapModal);
|
|
@ -14,6 +14,7 @@ import '../components/forms/FormControl.jsx'; // note: only used by old accounts
|
|||
|
||||
import '../components/ui/Button.jsx';
|
||||
import '../components/ui/Alert.jsx';
|
||||
import '../components/ui/Modal.jsx';
|
||||
import '../components/ui/ModalTrigger.jsx';
|
||||
import '../components/ui/TooltipTrigger.jsx';
|
||||
import '../components/ui/Dropdown.jsx';
|
||||
|
|
Loading…
Add table
Reference in a new issue