-
Notifications
You must be signed in to change notification settings - Fork 98
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
[FEATURE REQUEST] Load markup examples in iFrame to make them resizable and responsive #79
Comments
👍 This would also provide some encapsulation and solve the issue of CSS 'collision' between Astrum- and pattern styles (see #71). |
No thoughts on this? PS: I just came across https://github.com/edenspiekermann/iframify which could make this a lot easier. |
We're currently working on Astrum v2.0 and we're considering the best way to approach this. |
@davidhund Could you provide some context as to what style collisions you're experiencing? The issue with iFrames is, as @dlewand691 points out, unless they're 100% width of the page the project media queries won't work properly. |
@RyanHavoc Obviously content loaded on the page will inherit the global styles. So style collisions could be everywhere: patterns could be affected by Astrum styles (allthough not very likely since you 'namespace' all Astrum styles with The latter is my problem at the moment: my projects' non-specific styles are affecting the Astrum UI. For example: this happens often with 'resets' i.e. Normalize.css but also with .e.g. the 'Lobotomized Owl Selector' This is to be expected because my projects' styles are not 'encapsulated'. The other issue is that Media Query behaviour is 'non-realistic' when the content is loaded directly in the Astrum UI. Sure: they 'work' but the components do not live in their intended context so they'll break. Using iFrames, the MQ's respond to the width of the iFrame window (not the viewport). So while the pattern windows are not 100%. of the browser window, at least the patterns will behave according to their authored Media Queries. You can do a simple test with non-iframed patterns in Astrum and see how they'll break:
This will break When If you'll look at almost all other pattern library generators you'll see they address style encapsulation and media-queries with iFrames (untill Shadow Dom etc. are better supported 😉 |
@dlewand691 @davidhund I've been exploring lots of option to prevent style conflicts and the compromises we'd have to make by using iFrames are too great in my opinion. Instead I've been working on a scoped CSS approach that sandboxes project styles to the sample container. This has been working well in testing and I've just pushed a pre-release for Astrum 2.0.0 if you'd like to give it a try yourselves. Details here: https://github.com/NoDivide/astrum/releases/tag/2.0.0-rc.0 |
Awesome! Glad you've found an approach to this. Would love to try it, how do I update to a pre-release? |
@dlewand691 You'll need to pull down the |
Holy ****! Thanks! That worked! |
Instead of having to resize the whole browser window, I'd like to only resize my coded example. But simply making the div resizable doesn't make it responsive.
Putting the markup.html content into an iFrame and loading that allows the example to be responsive. It does require a 2nd html file to be the iFrame source and also that your server allow iFrames to load. The system currently does not pull the right html markup so that would need adjusting as well.
I have edited one section of my work-in-progress guide to show the example:
https://www.dannylewandowski.com/_cog-DEV/public/pattern-library/#group-grid-component-overview
The other sections below have the div set to resizable which you'll see does not recognize the responsive media queries.
The text was updated successfully, but these errors were encountered: