Browse Source

Added width optional prop to Modal

master
Thibaut Boustany 7 years ago
parent
commit
54a96995f4
No known key found for this signature in database GPG Key ID: 32475B11A2B13EEC
  1. 6
      src/components/base/Modal/index.js

6
src/components/base/Modal/index.js

@ -37,6 +37,7 @@ type OwnProps = {
preventBackdropClick?: boolean, preventBackdropClick?: boolean,
render: Function, render: Function,
refocusWhenChange?: string, refocusWhenChange?: string,
width?: string,
} }
type Props = OwnProps & { type Props = OwnProps & {
@ -108,7 +109,7 @@ const Wrapper = styled(Box).attrs({
}), }),
})` })`
outline: none; outline: none;
width: 500px; width: ${p => (p.width ? p.width : '500px')};
z-index: 2; z-index: 2;
` `
@ -180,7 +181,7 @@ export class Modal extends Component<Props> {
} }
render() { render() {
const { preventBackdropClick, isOpened, onHide, render, data, onClose } = this.props const { preventBackdropClick, isOpened, onHide, render, data, onClose, width } = this.props
return ( return (
<Mortal <Mortal
@ -204,6 +205,7 @@ export class Modal extends Component<Props> {
scale={m.scale} scale={m.scale}
innerRef={n => (this._wrapper = n)} innerRef={n => (this._wrapper = n)}
onClick={stopPropagation} onClick={stopPropagation}
width={width}
> >
<Pure isAnimated={isAnimated} render={render} data={data} onClose={onClose} /> <Pure isAnimated={isAnimated} render={render} data={data} onClose={onClose} />
</Wrapper> </Wrapper>

Loading…
Cancel
Save