Added logging, changed some directory structure

This commit is contained in:
2018-01-13 21:33:40 -05:00
parent f079a5f067
commit 8e72ffb917
73656 changed files with 35284 additions and 53718 deletions

View File

@@ -0,0 +1,39 @@
// @flow
import React from 'react';
import type { HigherOrderComponent } from 'react-flow-types';
import wrapDisplayName from 'recompose/wrapDisplayName';
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;
function WithMobileDialog(props: { width: string }) {
return <Component fullScreen={isWidthDown(breakpoint, props.width)} {...props} />;
}
if (process.env.NODE_ENV !== 'production') {
WithMobileDialog.displayName = wrapDisplayName(Component, 'withMobileDialog');
}
return withWidth()(WithMobileDialog);
};
export default withMobileDialog;