Skip to content

Commit

Permalink
[Popover] Adding ModalClasses prop to popover component
Browse files Browse the repository at this point in the history
  • Loading branch information
davibq committed Aug 9, 2018
1 parent 8029207 commit db624ee
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/material-ui/src/Popover/Popover.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface PopoverProps
getContentAnchorEl?: (element: HTMLElement) => HTMLElement;
marginThreshold?: number;
modal?: boolean;
ModalClasses?: ModalClassKey;
PaperProps?: Partial<PaperProps>;
role?: string;
transformOrigin?: PopoverOrigin;
Expand Down
13 changes: 12 additions & 1 deletion packages/material-ui/src/Popover/Popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ class Popover extends React.Component {
elevation,
getContentAnchorEl,
marginThreshold,
ModalClasses,
onEnter,
onEntered,
onEntering,
Expand Down Expand Up @@ -307,7 +308,13 @@ class Popover extends React.Component {
containerProp || (anchorEl ? ownerDocument(getAnchorEl(anchorEl)).body : undefined);

return (
<Modal container={container} open={open} BackdropProps={{ invisible: true }} {...other}>
<Modal
classes={ModalClasses}
container={container}
open={open}
BackdropProps={{ invisible: true }}
{...other}
>
<TransitionComponent
appear
in={open}
Expand Down Expand Up @@ -419,6 +426,10 @@ Popover.propTypes = {
* Specifies how close to the edge of the window the popover can appear.
*/
marginThreshold: PropTypes.number,
/**
* `classes` property applied to the [`Modal`](/api/modal) element.
*/
ModalClasses: PropTypes.object,
/**
* Callback fired when the component requests to be closed.
*
Expand Down
1 change: 1 addition & 0 deletions pages/api/popover.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ title: Popover API
| <span class="prop-name">elevation</span> | <span class="prop-type">number | <span class="prop-default">8</span> | The elevation of the popover. |
| <span class="prop-name">getContentAnchorEl</span> | <span class="prop-type">func |   | This function is called in order to retrieve the content anchor element. It's the opposite of the `anchorEl` property. The content anchor element should be an element inside the popover. It's used to correctly scroll and set the position of the popover. The positioning strategy tries to make the content anchor element just above the anchor element. |
| <span class="prop-name">marginThreshold</span> | <span class="prop-type">number | <span class="prop-default">16</span> | Specifies how close to the edge of the window the popover can appear. |
| <span class="prop-name">ModalClasses</span> | <span class="prop-type">object |   | Override or extend the styles applied to the Modal component. See [CSS API](#css-api) below for more details. |
| <span class="prop-name">onClose</span> | <span class="prop-type">func |   | Callback fired when the component requests to be closed.<br><br>**Signature:**<br>`function(event: object) => void`<br>*event:* The event source of the callback. |
| <span class="prop-name">onEnter</span> | <span class="prop-type">func |   | Callback fired before the component is entering. |
| <span class="prop-name">onEntered</span> | <span class="prop-type">func |   | Callback fired when the component has entered. |
Expand Down

0 comments on commit db624ee

Please sign in to comment.