Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Convert propTypes to Flow Props (#2842)
Browse files Browse the repository at this point in the history
* Conver propTypes to flow props

* Update App.js to use SourceRecord type
  • Loading branch information
AgtLucas authored and jasonLaster committed May 8, 2017
1 parent e6fbbd1 commit 699afe5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
17 changes: 10 additions & 7 deletions src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { connect } from "react-redux";
import { bindActionCreators } from "redux";
import actions from "../actions";
import { getSelectedSource, getPaneCollapse } from "../selectors";
import type { SourceRecord } from "../reducers/sources";

import { KeyShortcuts } from "devtools-modules";
const shortcuts = new KeyShortcuts({ window });
Expand Down Expand Up @@ -37,12 +38,21 @@ const WelcomeBox = createFactory(_WelcomeBox);
import _EditorTabs from "./Editor/Tabs";
const EditorTabs = createFactory(_EditorTabs);

type Props = {
selectSource: Function,
selectedSource: SourceRecord,
startPanelCollapsed: boolean,
endPanelCollapsed: boolean
};

class App extends Component {
state: {
horizontal: boolean,
startPanelSize: number,
endPanelSize: number
};

props: Props;
onLayoutChange: Function;
getChildContext: Function;
renderEditorPane: Function;
Expand Down Expand Up @@ -168,13 +178,6 @@ class App extends Component {
}
}

App.propTypes = {
selectSource: PropTypes.func,
selectedSource: PropTypes.object,
startPanelCollapsed: PropTypes.bool,
endPanelCollapsed: PropTypes.bool
};

App.displayName = "App";

App.childContextTypes = { shortcuts: PropTypes.object };
Expand Down
16 changes: 9 additions & 7 deletions src/components/WelcomeBox.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { DOM as dom, PropTypes, Component, createFactory } from "react";
import { DOM as dom, Component, createFactory } from "react";
import { connect } from "react-redux";
import { bindActionCreators } from "redux";

Expand All @@ -12,7 +12,15 @@ const PaneToggleButton = createFactory(_PaneToggleButton);

import "./WelcomeBox.css";

type Props = {
horizontal: boolean,
togglePaneCollapse: Function,
endPanelCollapsed: boolean
};

class WelcomeBox extends Component {
props: Props;

renderToggleButton() {
if (this.props.horizontal) {
return;
Expand All @@ -39,12 +47,6 @@ class WelcomeBox extends Component {
}
}

WelcomeBox.propTypes = {
horizontal: PropTypes.bool,
togglePaneCollapse: PropTypes.func,
endPanelCollapsed: PropTypes.bool
};

WelcomeBox.displayName = "WelcomeBox";

export default connect(
Expand Down

0 comments on commit 699afe5

Please sign in to comment.