diff --git a/src/ui/components/Sheet.js b/src/ui/components/Sheet.tsx similarity index 81% rename from src/ui/components/Sheet.js rename to src/ui/components/Sheet.tsx index 1262e4f0c..af2648389 100644 --- a/src/ui/components/Sheet.js +++ b/src/ui/components/Sheet.tsx @@ -11,31 +11,39 @@ import {connect} from 'react-redux'; import { ACTIVE_SHEET_PLUGIN_SHEET, setActiveSheet, -} from '../../reducers/application.tsx'; - -import type {ActiveSheet} from '../../reducers/application.tsx'; + ActiveSheet, +} from '../../reducers/application'; +import {State as Store} from '../../reducers'; export const PLUGIN_SHEET_ELEMENT_ID = 'pluginSheetContents'; -type Props = { +type OwnProps = { /** * 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 * 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. */ - onHideSheet: () => void, - setActiveSheet: (sheet: ActiveSheet) => any, - activeSheet: ActiveSheet, + activeSheet: ActiveSheet; +}; + +type DispatchFromProps = { + setActiveSheet: (sheet: ActiveSheet) => any; }; type State = { - content: ?React.Node, + content: React.ReactNode | undefined; }; +type Props = OwnProps & DispatchFromProps & StateFromProps; + /** * Usage: {onHide => } */ @@ -101,8 +109,7 @@ class Sheet extends Component { } } -// $FlowFixMe -export default connect( +export default connect( ({application: {activeSheet}}) => ({activeSheet}), {setActiveSheet}, )(Sheet); diff --git a/src/ui/index.js b/src/ui/index.js index e8d87101c..7f82e2a4c 100644 --- a/src/ui/index.js +++ b/src/ui/index.js @@ -182,4 +182,4 @@ export {InspectorSidebar} from './components/elements-inspector/sidebar.js'; export {Console} from './components/console.tsx'; -export {default as Sheet} from './components/Sheet.js'; +export {default as Sheet} from './components/Sheet.tsx';