Completely updated React, fixed #11, (hopefully)
This commit is contained in:
29
goTorrentWebUI/node_modules/material-ui/Dialog/withMobileDialog.js.flow
generated
vendored
29
goTorrentWebUI/node_modules/material-ui/Dialog/withMobileDialog.js.flow
generated
vendored
@@ -1,37 +1,22 @@
|
||||
// @flow
|
||||
|
||||
import React from 'react';
|
||||
import type { HigherOrderComponent } from 'react-flow-types';
|
||||
import wrapDisplayName from 'recompose/wrapDisplayName';
|
||||
import PropTypes from 'prop-types';
|
||||
import withWidth, { isWidthDown } from '../utils/withWidth';
|
||||
import type { Breakpoint } from '../styles/createBreakpoints';
|
||||
|
||||
type Options = { breakpoint: Breakpoint };
|
||||
|
||||
export type InjectedProps = {
|
||||
/**
|
||||
* If isWidthDown(options.breakpoint), return true.
|
||||
*/
|
||||
fullScreen: boolean,
|
||||
};
|
||||
|
||||
/**
|
||||
* Dialog will responsively be full screen *at or below* the given breakpoint
|
||||
* (defaults to 'sm' for mobile devices).
|
||||
* Notice that this Higher-order Component is incompatible with server side rendering.
|
||||
*/
|
||||
const withMobileDialog = (
|
||||
options: Options = { breakpoint: 'sm' },
|
||||
): HigherOrderComponent<{}, InjectedProps> => (Component: any): any => {
|
||||
const { breakpoint } = options;
|
||||
const withMobileDialog = (options = {}) => Component => {
|
||||
const { breakpoint = 'sm' } = options;
|
||||
|
||||
function WithMobileDialog(props: { width: string }) {
|
||||
function WithMobileDialog(props) {
|
||||
return <Component fullScreen={isWidthDown(breakpoint, props.width)} {...props} />;
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
WithMobileDialog.displayName = wrapDisplayName(Component, 'withMobileDialog');
|
||||
}
|
||||
WithMobileDialog.propTypes = {
|
||||
width: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']).isRequired,
|
||||
};
|
||||
|
||||
return withWidth()(WithMobileDialog);
|
||||
};
|
||||
|
Reference in New Issue
Block a user