I'm currently working on personalizing a fiat-to-crypto integration widget to align with the style of my react application.
The setup involves a reactjs platform using material ui, with the widget embedded in an iFrame.
An individual has successfully accomplished this customization here:
After inspecting their implementation, I'm facing challenges replicating it within my react app.
I've experimented with two approaches:
APPROACH ONE
Attempting to access contentWindow.document - unfortunately, querying reveals no visible document:
function changeStuff() {
const onramperWindow = onramper.contentWindow;
console.log(onramperWindow)
const onramperDocument = onramperWindow.document
console.log(onramperDocument)
}
This approach encounters errors as the document doesn't appear accessible outside of the parent element which isn't the target for editing.
APPROACH TWO
Given that my react app utilizes MUI, I tried incorporating useStyles:
const useStyles = makeStyles({
embedContainer: {
"& iframe": {
position: "absolute",
top: 0,
left: 0,
width: "50%",
height: "100%",
color: "#000000"
}
}
});
Followed by integrating the iframe:
<iframe
id="onramper"
src="https://widget.onramper.comcolor=346eeb&apiKey=pk_test_x5M_5fdXzn1fxK04seu0JgFjGsu7CH8lOvS9xZWzuSM0"
height="595px"
width="800px"
title="Onramper widget"
frameborder="no"
allow="accelerometer;
autoplay; camera; gyroscope; payment"
className={classes.embedContainer}
>
<a href="https://widget.onramper.com" target="_blank">Buy crypto</a>
</iframe>
However, this method results in the entire screen turning black due to injecting css across the entire page.
If anyone has insights, tips, or resources on how to customize the CSS of this iframe widget, I would greatly appreciate it.