Fix liquidity source change

This commit is contained in:
Fred Carlsen
2018-12-17 13:31:41 +01:00
parent 7065a098e3
commit 88240f6401
2 changed files with 6 additions and 4 deletions

View File

@@ -64,7 +64,7 @@ export class ConfigGenerator extends React.Component<ConfigGeneratorProps, Confi
return (
<Container minWidth="350px">
<ConfigGeneratorSection title="Liquidity Source">
<Select id="" value={value.orderSource} items={this._generateItems()} />
<Select id="" value={value.orderSource} items={this._generateItems()} onChange={this._handleSRASelection.bind(this)} />
</ConfigGeneratorSection>
<ConfigGeneratorSection {...this._getTokenSelectorProps()}>
{this._renderTokenMultiSelectOrSpinner()}
@@ -122,7 +122,8 @@ export class ConfigGenerator extends React.Component<ConfigGeneratorProps, Confi
private readonly _handleAffiliatePercentageLearnMoreClick = (): void => {
window.open(`${WebsitePaths.Wiki}#Learn-About-Affiliate-Fees`, '_blank');
};
private readonly _handleSRASelection = (sraEndpoint: string) => {
private readonly _handleSRASelection = (event: Event) => {
const sraEndpoint = event.target.value;
const newConfig: ZeroExInstantBaseConfig = {
...this.props.value,
orderSource: sraEndpoint,

View File

@@ -12,12 +12,13 @@ interface SelectProps {
id: string;
items: SelectItemConfig[];
emptyText?: string;
onChange?: () => void;
}
export const Select: React.FunctionComponent<SelectProps> = ({ value, id, items, emptyText }) => {
export const Select: React.FunctionComponent<SelectProps> = ({ value, id, items, emptyText, onChange }) => {
return (
<Container>
<StyledSelect id={id}>
<StyledSelect id={id} onChange={onChange}>
<option value="">{emptyText}</option>
{items.map((item, index) => <option key={`${id}-item-${index}`} value={item.value} selected={item.value === value} onClick={item.onClick}>{item.label}</option>)}
</StyledSelect>