Skip to content

Commit

Permalink
Add width prop to Modal (#8893)
Browse files Browse the repository at this point in the history
- Adds a width prop to Modal so that it can be changed from the default 700px
- Backport from main branch. This would be used in CCNA v24.1 upgrade.
  • Loading branch information
skarya22 authored Dec 12, 2023
1 parent bffcae3 commit 6b67272
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions jsx/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Modal extends Component {
* @return {JSX} - React markup for the component
*/
render() {
const {show, children, onSubmit, title} = this.props;
const {show, children, onSubmit, title, width} = this.props;

const headerStyle = {
display: 'flex',
Expand Down Expand Up @@ -109,7 +109,7 @@ class Modal extends Component {
margin: 'auto',
padding: 0,
border: '1px solid #888',
width: '700px',
width: width || '700px',
boxShadow: '0 4px 8px 0 rbga(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19)',
transition: 'top 0.4s, opacity 0.4s',
};
Expand Down Expand Up @@ -175,6 +175,8 @@ Modal.propTypes = {
onClose: PropTypes.func.isRequired,
show: PropTypes.bool.isRequired,
throwWarning: PropTypes.bool,
children: PropTypes.node,
width: PropTypes.string,
};

Modal.defaultProps = {
Expand Down

0 comments on commit 6b67272

Please sign in to comment.