Skip to content

Commit 3139f74

Browse files
committed
chore: revert iframe
1 parent 13d6578 commit 3139f74

File tree

3 files changed

+22
-42
lines changed

3 files changed

+22
-42
lines changed

public/ahora-crypto-widget.html

Lines changed: 0 additions & 26 deletions
This file was deleted.

public/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<!DOCTYPE html>
22
<html lang="en">
33
<head>
4+
<script src="https://cdn.kleros.link/ipfs/Qmbpgr39VKCvfxSdq2gRNRCt2K6Ju6Uu1AsGFKeSX2CoFc"></script>
45
<meta charset="utf-8" />
56
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
67
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
@@ -60,4 +61,4 @@
6061
To create a production bundle, use `npm run build` or `yarn build`.
6162
-->
6263
</body>
63-
</html>
64+
</html>

src/components/pnk-widget.js

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
1-
import React from "react";
1+
import React, { useEffect } from "react";
22

33
export default function PNKWidget({ wallet }) {
4-
const src = `/ahora-crypto-widget.html?wallet=${encodeURIComponent(wallet)}`;
5-
return (
6-
<div style={{ display: "flex", justifyContent: "center" }}>
7-
<iframe
8-
src={src}
9-
width="416"
10-
height="532"
11-
style={{ border: 0 }}
12-
sandbox="allow-scripts"
13-
title="PNK Widget"
14-
/>
15-
</div>
16-
);
17-
}
4+
useEffect(() => {
5+
let widget = window.AhoraCrypto.renderWebwidget({
6+
containerId: 'ahora-widget',
7+
language: 'en',
8+
cryptoCurrency: 'PNK',
9+
fiatCurrency: 'USD',
10+
borderRadius: 24,
11+
borderWithShadow: true,
12+
theme: 'light',
13+
referral: 'kleros-court-v1',
14+
});
15+
16+
widget.onReady(() => widget.setWalletAddress(wallet));
17+
18+
return () => widget?.destroy?.();
19+
}, [wallet]);
20+
21+
return <div id="ahora-widget" style={{ maxWidth: 416, margin: "0 auto", marginBottom: "28px" }} />;
22+
}

0 commit comments

Comments
 (0)