Sheet
Summary: _typescript_ Reviewed By: priteshrnandgaonkar Differential Revision: D16828874 fbshipit-source-id: 1111d5e5ceae38c7af0a5e211efbbad57a110a45
This commit is contained in:
committed by
Facebook Github Bot
parent
4ad072aa2c
commit
dedf09c2ae
@@ -11,31 +11,39 @@ import {connect} from 'react-redux';
|
|||||||
import {
|
import {
|
||||||
ACTIVE_SHEET_PLUGIN_SHEET,
|
ACTIVE_SHEET_PLUGIN_SHEET,
|
||||||
setActiveSheet,
|
setActiveSheet,
|
||||||
} from '../../reducers/application.tsx';
|
ActiveSheet,
|
||||||
|
} from '../../reducers/application';
|
||||||
import type {ActiveSheet} from '../../reducers/application.tsx';
|
import {State as Store} from '../../reducers';
|
||||||
|
|
||||||
export const PLUGIN_SHEET_ELEMENT_ID = 'pluginSheetContents';
|
export const PLUGIN_SHEET_ELEMENT_ID = 'pluginSheetContents';
|
||||||
|
|
||||||
type Props = {
|
type OwnProps = {
|
||||||
/**
|
/**
|
||||||
* Function as child component (FaCC) to render the contents of the sheet.
|
* Function as child component (FaCC) to render the contents of the sheet.
|
||||||
* A `onHide` function is passed as argument, that can be called to remove
|
* A `onHide` function is passed as argument, that can be called to remove
|
||||||
* the sheet.
|
* the sheet.
|
||||||
*/
|
*/
|
||||||
children: (onHide: () => void) => ?React.Node,
|
children: (onHide: () => void) => React.ReactNode | undefined;
|
||||||
|
onHideSheet: () => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
type StateFromProps = {
|
||||||
/**
|
/**
|
||||||
* Function that is called when the sheet becomes hidden.
|
* Function that is called when the sheet becomes hidden.
|
||||||
*/
|
*/
|
||||||
onHideSheet: () => void,
|
activeSheet: ActiveSheet;
|
||||||
setActiveSheet: (sheet: ActiveSheet) => any,
|
};
|
||||||
activeSheet: ActiveSheet,
|
|
||||||
|
type DispatchFromProps = {
|
||||||
|
setActiveSheet: (sheet: ActiveSheet) => any;
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
content: ?React.Node,
|
content: React.ReactNode | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type Props = OwnProps & DispatchFromProps & StateFromProps;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Usage: <Sheet>{onHide => <YourSheetContent onHide={onHide} />}</Sheet>
|
* Usage: <Sheet>{onHide => <YourSheetContent onHide={onHide} />}</Sheet>
|
||||||
*/
|
*/
|
||||||
@@ -101,8 +109,7 @@ class Sheet extends Component<Props, State> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// $FlowFixMe
|
export default connect<StateFromProps, DispatchFromProps, OwnProps, Store>(
|
||||||
export default connect(
|
|
||||||
({application: {activeSheet}}) => ({activeSheet}),
|
({application: {activeSheet}}) => ({activeSheet}),
|
||||||
{setActiveSheet},
|
{setActiveSheet},
|
||||||
)(Sheet);
|
)(Sheet);
|
||||||
@@ -182,4 +182,4 @@ export {InspectorSidebar} from './components/elements-inspector/sidebar.js';
|
|||||||
|
|
||||||
export {Console} from './components/console.tsx';
|
export {Console} from './components/console.tsx';
|
||||||
|
|
||||||
export {default as Sheet} from './components/Sheet.js';
|
export {default as Sheet} from './components/Sheet.tsx';
|
||||||
|
|||||||
Reference in New Issue
Block a user