-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a prop for a custom document (good for iframes). #33
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for submitting a PR! 🙏
I'm just a little confused about the PropTypes/Typescript definitions you've added, can you explain? 😃
Hi @Reklino, how's it going - did you manage to figure out what the types should be? 😆😋 |
@jakewtaylor thanks for the reminder. #document is just a good old |
Apologies for the delay @Reklino, the code looks good to me now. Sorry to be a pain, but could you provide a small example of how this new prop works, just so I can test it? 😄 |
@jakewtaylor sure! If you have a rendered Example using const MyComponent = (props, context) => (
<Fragment>
<Frame>
<FrameContextConsumer>
{
// Callback is invoked with iframe's window and document instances
({document, window}) => {
<Fragment>
<GoogleFontLoader
fonts={[
{
font: 'Roboto',
weights: [400, '400i'],
},
]}
contentDocument={document}
/>
<h1 style={{ fontFamily: 'Roboto'; }}>Will render with Roboto</h1>
</Fragment>
}
}
</FrameContextConsumer>
</Frame>
<h1 style={{ fontFamily: 'Roboto'; }}>Will not render with Roboto</h1>
</Fragment>
); Of course, you don't have to use |
Hey @jakewtaylor 👋 . Any chance we could merge this one in? |
Hey there! This is great little tool 🙏 . Thanks for putting it together.
I'm using this in a project that uses Google Fonts in an iframe, so I need the
<style>
tags to be included in that document rather than the basedocument
. This simply adds a new prop for this use case.