import { colors, constants as sharedConstants } from '@0xproject/react-shared'; import { RadioButton, RadioButtonGroup } from 'material-ui/RadioButton'; import * as React from 'react'; import { Blockchain } from 'ts/blockchain'; import { Dispatcher } from 'ts/redux/dispatcher'; import { ProviderType } from 'ts/types'; interface ProviderPickerProps { networkId: number; injectedProviderName: string; providerType: ProviderType; onToggleLedgerDialog: () => void; dispatcher: Dispatcher; blockchain: Blockchain; } interface ProviderPickerState {} export class ProviderPicker extends React.Component { public render(): React.ReactNode { const isLedgerSelected = this.props.providerType === ProviderType.Ledger; const menuStyle = { padding: 10, paddingTop: 15, paddingBottom: 15, }; // Show dropdown with two options return (
); } private _renderLabel(title: string, shouldShowNetwork: boolean): React.ReactNode { const label = (
{title}
{shouldShowNetwork && this._renderNetwork()}
); return label; } private _renderNetwork(): React.ReactNode { const networkName = sharedConstants.NETWORK_NAME_BY_ID[this.props.networkId]; return (
{networkName}
); } private _onProviderRadioChanged(value: string): void { if (value === ProviderType.Ledger) { this.props.onToggleLedgerDialog(); } else { // tslint:disable-next-line:no-floating-promises this.props.blockchain.updateProviderToInjectedAsync(); } } }