feat: update configurator snippet to actually work if copy and pasted
This commit is contained in:
parent
ea4155e5fa
commit
dfe5752411
@ -22,7 +22,7 @@ export class Configurator extends React.Component<ConfiguratorProps> {
|
|||||||
public state: ConfiguratorState = {
|
public state: ConfiguratorState = {
|
||||||
instantConfig: {
|
instantConfig: {
|
||||||
orderSource: 'https://api.radarrelay.com/0x/v2/',
|
orderSource: 'https://api.radarrelay.com/0x/v2/',
|
||||||
availableAssetDatas: [],
|
availableAssetDatas: undefined,
|
||||||
affiliateInfo: {
|
affiliateInfo: {
|
||||||
feeRecipient: '',
|
feeRecipient: '',
|
||||||
feePercentage: 0.01,
|
feePercentage: 0.01,
|
||||||
@ -65,7 +65,10 @@ export class Configurator extends React.Component<ConfiguratorProps> {
|
|||||||
};
|
};
|
||||||
private readonly _generateCodeDemoCode = (): string => {
|
private readonly _generateCodeDemoCode = (): string => {
|
||||||
const { instantConfig } = this.state;
|
const { instantConfig } = this.state;
|
||||||
return `<head>
|
return `<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
<script src="https://instant.0xproject.com/instant.js"></script>
|
<script src="https://instant.0xproject.com/instant.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -87,13 +90,16 @@ export class Configurator extends React.Component<ConfiguratorProps> {
|
|||||||
}
|
}
|
||||||
}, 'body');
|
}, 'body');
|
||||||
</script>
|
</script>
|
||||||
</body>`;
|
</body>
|
||||||
|
</html>`;
|
||||||
};
|
};
|
||||||
private readonly _renderAvailableAssetDatasString = (availableAssetDatas: string[]): string => {
|
private readonly _renderAvailableAssetDatasString = (availableAssetDatas: string[]): string => {
|
||||||
const stringAvailableAssetDatas = availableAssetDatas.map(assetData => `'${assetData}'`);
|
const stringAvailableAssetDatas = availableAssetDatas.map(assetData => `'${assetData}'`);
|
||||||
if (availableAssetDatas.length < 2) {
|
if (availableAssetDatas.length < 2) {
|
||||||
return `[${stringAvailableAssetDatas.join(', ')}]`;
|
return `[${stringAvailableAssetDatas.join(', ')}]`;
|
||||||
}
|
}
|
||||||
return `[\n\t\t${stringAvailableAssetDatas.join(', \n\t\t')}\n ]`;
|
return `[\n ${stringAvailableAssetDatas.join(
|
||||||
|
', \n ',
|
||||||
|
)}\n ]`;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user