Migrated LocationsButton from js to ts

Summary:
This isn't used anywher at the moment but I plan to add it in once we are finished with TS migration.

Migrated this file from LocationsButton.js to LocationsButton.ts

Reviewed By: jknoxville

Differential Revision: D16730904

fbshipit-source-id: d357785c462b1f5f6017b4c00a2d2467d905b895
This commit is contained in:
Benjamin Elo
2019-08-12 05:49:44 -07:00
committed by Facebook Github Bot
parent beaf4997fe
commit dcda5741b9

View File

@@ -5,25 +5,29 @@
* @format * @format
*/ */
import {Button, Component, styled} from 'flipper'; import {Button, styled} from 'flipper';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import React, {Component} from 'react';
import {State} from '../reducers';
import type BaseDevice from '../devices/BaseDevice.tsx'; import BaseDevice from '../devices/BaseDevice';
type OwnProps = {| type OwnProps = {
locations: Array<string>, locations: Array<string>;
selectedLocation?: string, selectedLocation?: string;
|}; };
type Props = {| type StateFromProps = {
...OwnProps, selectedDevice: BaseDevice | null | undefined;
selectedDevice?: BaseDevice, };
|};
type DispatchFromProps = {};
const DropdownButton = styled(Button)({ const DropdownButton = styled(Button)({
fontSize: 11, fontSize: 11,
}); });
type Props = OwnProps & StateFromProps & DispatchFromProps;
class LocationsButton extends Component<Props> { class LocationsButton extends Component<Props> {
goToLocation = (location: string) => { goToLocation = (location: string) => {
const {selectedDevice} = this.props; const {selectedDevice} = this.props;
@@ -51,7 +55,7 @@ class LocationsButton extends Component<Props> {
} }
} }
export default connect<Props, OwnProps, _, _, _, _>( export default connect<StateFromProps, DispatchFromProps, OwnProps, State>(
({connections: {selectedDevice}}) => ({ ({connections: {selectedDevice}}) => ({
selectedDevice, selectedDevice,
}), }),