feat: add fee percentage slider
This commit is contained in:
parent
de1c296d28
commit
50bfbda79a
@ -20,7 +20,7 @@ const CustomPre = styled.pre`
|
|||||||
code:first-of-type {
|
code:first-of-type {
|
||||||
background-color: #2a2a2a !important;
|
background-color: #2a2a2a !important;
|
||||||
color: #999;
|
color: #999;
|
||||||
height: 100%;
|
min-height: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding-right: 5px !important;
|
padding-right: 5px !important;
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
|
@ -53,14 +53,14 @@ export class ConfigGenerator extends React.Component<ConfigGeneratorProps, Confi
|
|||||||
throw new Error('ConfigGenerator component only supports string values as an orderSource.');
|
throw new Error('ConfigGenerator component only supports string values as an orderSource.');
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container minWidth="350px">
|
||||||
<ConfigGeneratorSection title="Standard relayer API endpoint">
|
<ConfigGeneratorSection title="Standard relayer API endpoint">
|
||||||
<Select value={value.orderSource} items={this._generateItems()} />
|
<Select value={value.orderSource} items={this._generateItems()} />
|
||||||
</ConfigGeneratorSection>
|
</ConfigGeneratorSection>
|
||||||
<ConfigGeneratorSection {...this._getTokenSelectorProps()}>
|
<ConfigGeneratorSection {...this._getTokenSelectorProps()}>
|
||||||
{this._renderTokenMultiSelectOrSpinner()}
|
{this._renderTokenMultiSelectOrSpinner()}
|
||||||
</ConfigGeneratorSection>
|
</ConfigGeneratorSection>
|
||||||
<ConfigGeneratorSection title="Transaction fee ETH address">
|
<ConfigGeneratorSection title="Transaction fee ETH address" marginBottom="10px" isOptional={true}>
|
||||||
<ConfigGeneratorAddressInput
|
<ConfigGeneratorAddressInput
|
||||||
value={value.affiliateInfo ? value.affiliateInfo.feeRecipient : ''}
|
value={value.affiliateInfo ? value.affiliateInfo.feeRecipient : ''}
|
||||||
onChange={this._handleAffiliateAddressChange}
|
onChange={this._handleAffiliateAddressChange}
|
||||||
@ -252,19 +252,30 @@ export interface ConfigGeneratorSectionProps {
|
|||||||
title: string;
|
title: string;
|
||||||
actionText?: string;
|
actionText?: string;
|
||||||
onActionTextClick?: () => void;
|
onActionTextClick?: () => void;
|
||||||
|
isOptional?: boolean;
|
||||||
|
marginBottom?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ConfigGeneratorSection: React.StatelessComponent<ConfigGeneratorSectionProps> = ({
|
export const ConfigGeneratorSection: React.StatelessComponent<ConfigGeneratorSectionProps> = ({
|
||||||
title,
|
title,
|
||||||
actionText,
|
actionText,
|
||||||
onActionTextClick,
|
onActionTextClick,
|
||||||
|
isOptional,
|
||||||
|
marginBottom,
|
||||||
children,
|
children,
|
||||||
}) => (
|
}) => (
|
||||||
<Container marginBottom="30px">
|
<Container marginBottom={marginBottom}>
|
||||||
<Container marginBottom="10px" className="flex justify-between items-center">
|
<Container marginBottom="10px" className="flex justify-between items-center">
|
||||||
|
<Container>
|
||||||
<Text fontColor={colors.white} fontSize="16px" lineHeight="18px">
|
<Text fontColor={colors.white} fontSize="16px" lineHeight="18px">
|
||||||
{title}
|
{title}
|
||||||
</Text>
|
</Text>
|
||||||
|
{isOptional && (
|
||||||
|
<Text fontColor={colors.grey} fontSize="16px" lineHeight="18px">
|
||||||
|
(optional)
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
</Container>
|
||||||
{actionText && (
|
{actionText && (
|
||||||
<Text fontSize="12px" fontColor={colors.grey} onClick={onActionTextClick}>
|
<Text fontSize="12px" fontColor={colors.grey} onClick={onActionTextClick}>
|
||||||
{actionText}
|
{actionText}
|
||||||
@ -274,3 +285,7 @@ export const ConfigGeneratorSection: React.StatelessComponent<ConfigGeneratorSec
|
|||||||
{children}
|
{children}
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
ConfigGeneratorSection.defaultProps = {
|
||||||
|
marginBottom: '30px',
|
||||||
|
};
|
||||||
|
@ -28,7 +28,7 @@ export class ConfigGeneratorAddressInput extends React.Component<
|
|||||||
const hasError = !_.isEmpty(errMsg);
|
const hasError = !_.isEmpty(errMsg);
|
||||||
const border = hasError ? '1px solid red' : undefined;
|
const border = hasError ? '1px solid red' : undefined;
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container height="80px">
|
||||||
<Input
|
<Input
|
||||||
width="100%"
|
width="100%"
|
||||||
fontSize="16px"
|
fontSize="16px"
|
||||||
@ -37,13 +37,11 @@ export class ConfigGeneratorAddressInput extends React.Component<
|
|||||||
placeholder="0xe99...aa8da4"
|
placeholder="0xe99...aa8da4"
|
||||||
border={border}
|
border={border}
|
||||||
/>
|
/>
|
||||||
{hasError && (
|
<Container marginTop="5px" isHidden={!hasError} height="25px">
|
||||||
<Container marginTop="5px">
|
|
||||||
<Text fontSize="14px" fontColor={colors.grey} fontStyle="italic">
|
<Text fontSize="14px" fontColor={colors.grey} fontStyle="italic">
|
||||||
{errMsg}
|
{errMsg}
|
||||||
</Text>
|
</Text>
|
||||||
</Container>
|
</Container>
|
||||||
)}
|
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ export class Configurator extends React.Component<ConfiguratorProps> {
|
|||||||
</Container>
|
</Container>
|
||||||
<ConfigGenerator value={this.state.instantConfig} onConfigChange={this._handleConfigChange} />
|
<ConfigGenerator value={this.state.instantConfig} onConfigChange={this._handleConfigChange} />
|
||||||
</Container>
|
</Container>
|
||||||
<Container className="mx3">
|
<Container className="mx3" height="550px">
|
||||||
<Container className="mb3 flex justify-between">
|
<Container className="mb3 flex justify-between">
|
||||||
<Text fontSize="20px" lineHeight="28px" fontColor={colors.white} fontWeight={500}>
|
<Text fontSize="20px" lineHeight="28px" fontColor={colors.white} fontWeight={500}>
|
||||||
Code Snippet
|
Code Snippet
|
||||||
@ -73,14 +73,14 @@ export class Configurator extends React.Component<ConfiguratorProps> {
|
|||||||
zeroExInstant.render({
|
zeroExInstant.render({
|
||||||
liquiditySource: '${instantConfig.orderSource}',${
|
liquiditySource: '${instantConfig.orderSource}',${
|
||||||
!_.isUndefined(instantConfig.affiliateInfo) && instantConfig.affiliateInfo.feeRecipient
|
!_.isUndefined(instantConfig.affiliateInfo) && instantConfig.affiliateInfo.feeRecipient
|
||||||
? `\n\t\taffiliateInfo: {
|
? `\n affiliateInfo: {
|
||||||
feeRecipient: '${instantConfig.affiliateInfo.feeRecipient}',
|
feeRecipient: '${instantConfig.affiliateInfo.feeRecipient}',
|
||||||
feePercentage: ${instantConfig.affiliateInfo.feePercentage}
|
feePercentage: ${instantConfig.affiliateInfo.feePercentage}
|
||||||
}`
|
}`
|
||||||
: ''
|
: ''
|
||||||
}${
|
}${
|
||||||
!_.isUndefined(instantConfig.availableAssetDatas)
|
!_.isUndefined(instantConfig.availableAssetDatas)
|
||||||
? `\n\t\tavailableAssetDatas: ${this._renderAvailableAssetDatasString(
|
? `\n availableAssetDatas: ${this._renderAvailableAssetDatasString(
|
||||||
instantConfig.availableAssetDatas,
|
instantConfig.availableAssetDatas,
|
||||||
)}`
|
)}`
|
||||||
: ''
|
: ''
|
||||||
@ -94,6 +94,6 @@ export class Configurator extends React.Component<ConfiguratorProps> {
|
|||||||
if (availableAssetDatas.length < 2) {
|
if (availableAssetDatas.length < 2) {
|
||||||
return `[${stringAvailableAssetDatas.join(', ')}]`;
|
return `[${stringAvailableAssetDatas.join(', ')}]`;
|
||||||
}
|
}
|
||||||
return `[\n\t\t\t${stringAvailableAssetDatas.join(', \n\t\t\t')}\n\t\t]`;
|
return `[\n\t\t${stringAvailableAssetDatas.join(', \n\t\t')}\n ]`;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user