MyCrypto/common/components/GasLimitFieldFactory/GasLimitInputFactory.tsx
William O'Beirne edda9f71ea Improved Gas UX (Pt. 1 - Gas Slider on Send) (#728)
* Initial crack at simple only gas slider component.

* Work on advanced component. Refactor redux and components to specify gas limit vs price.

* Convert fee summary to a render cbesque thing.

* Rework responsive columns.

* Remove force offline button.

* Tweak styles.

* Fix tscheck issues, remove unneeded prop.

* Fix references to GasField

* Gas slider in lite send.

* Make gas slider network-aware for symbol and price calculation.
2018-01-07 10:43:06 -06:00

35 lines
964 B
TypeScript

import React, { Component } from 'react';
import { Query } from 'components/renderCbs';
import { connect } from 'react-redux';
import { AppState } from 'reducers';
import { getGasLimit } from 'selectors/transaction';
import { CallBackProps } from 'components/GasLimitFieldFactory';
interface StateProps {
gasLimit: AppState['transaction']['fields']['gasLimit'];
}
interface OwnProps {
withProps(props: CallBackProps);
onChange(value: React.FormEvent<HTMLInputElement>): void;
}
type Props = StateProps & OwnProps;
class GasLimitInputClass extends Component<Props> {
public render() {
const { gasLimit, onChange } = this.props;
return (
<Query
params={['readOnly']}
withQuery={({ readOnly }) =>
this.props.withProps({ gasLimit, onChange, readOnly: !!readOnly })
}
/>
);
}
}
export const GasLimitInput = connect((state: AppState) => ({ gasLimit: getGasLimit(state) }))(
GasLimitInputClass
);