mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Improve typing for Dialog
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import React from 'react';
|
||||
// @flow
|
||||
import * as React from 'react';
|
||||
import Dialog from 'material-ui/Dialog';
|
||||
|
||||
const styles = {
|
||||
@@ -16,11 +17,44 @@ const styles = {
|
||||
},
|
||||
};
|
||||
|
||||
// We support a subset of the props supported by Material-UI v0.x Dialog
|
||||
// They should be self descriptive - refer to Material UI docs otherwise.
|
||||
type Props = {|
|
||||
open?: boolean,
|
||||
noMargin?: boolean,
|
||||
title?: React.Node,
|
||||
actions?: React.Node,
|
||||
secondaryActions?: React.Node,
|
||||
|
||||
onRequestClose?: () => void,
|
||||
|
||||
modal?: boolean, // Force the user to use one of the actions in the Dialog. Clicking outside the Dialog will not trigger the onRequestClose.
|
||||
|
||||
children: React.Node, // The content of the dialog
|
||||
|
||||
// Style:
|
||||
contentStyle?: {|
|
||||
maxWidth?: string | number,
|
||||
width?: string,
|
||||
|},
|
||||
titleStyle?: {| padding?: 0 |},
|
||||
bodyStyle?: {|
|
||||
padding?: 0,
|
||||
display?: 'flex',
|
||||
flexDirection?: 'row',
|
||||
overflowX?: 'hidden',
|
||||
|},
|
||||
|
||||
// Positioning:
|
||||
autoScrollBodyContent?: boolean,
|
||||
repositionOnUpdate?: boolean,
|
||||
|};
|
||||
|
||||
/**
|
||||
* A enhanced material-ui Dialog that can have optional secondary actions
|
||||
* and no margins if required.
|
||||
*/
|
||||
export default props => {
|
||||
export default (props: Props) => {
|
||||
const { secondaryActions, actions, noMargin, title, ...otherProps } = props;
|
||||
const dialogActions = secondaryActions
|
||||
? [
|
||||
|
@@ -51,7 +51,7 @@ export class ListItem extends React.Component<ListItemProps, {||}> {
|
||||
// into ListItem props and assumes nestedItems is always an array.
|
||||
static defaultProps = {
|
||||
nestedItems: [],
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
return <MUIListItem {...this.props} />;
|
||||
|
Reference in New Issue
Block a user