-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 responsive grid classnames for new grid system #149
Conversation
@tilomitra Ideally we can come up with more forward looking names than |
*/ | ||
@media (min-width: 480px) { | ||
.tablet-1 { | ||
width: 100%; } | ||
|
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.
The new declarations are missing pure-
prefix and need a newline after the last rule.
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.
Yeah, I'll prettify the newline issue. I didn't add a pure-
prefix on purpose since I felt all this is encapsulated within a pure-grid
and there was no need to add further bloat to class names that people will be repeatedly typing.
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.
The indentation is also different. For some reason all these Grids changes are using 2 space indentation while the rest of Pure uses 4 spaces.
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.
That's because this is getting compiled from a SASS file that I wrote so that I don't have to repeatedly determine the *width
for oldIE manually. I'll prettify it once we are ok with the code.
I thought about this a lot and couldn't come up with anything better at this point. Rather than noodle on it and hold this back, I thought it was best to ship something. |
@tilomitra This seems like a great opportunity to noodle on it. |
@msweeney We had this discussion a few weeks back with @ericf and I thought about it for a good while. We narrowed it down to a few possibilities: Semantic names such as
|
@tilomitra I agree that I'm not willing to block this PR based on the current names, but I want to give folks the opportunity to chime in with other ideas here. |
@tilomitra I'm to have |
@AurelioDeRosa To clarify, we are looking for alternatives to |
@msweeney I know. I was just expressing my thoughts on default. |
@AurelioDeRosa OK, cool, I just wanted to make sure I wasn't derailing with my |
@tilomitra What about this:
This is a relation to a size everybody understands and is able to handle without a documentation and it is device independent. |
@xlnt-webdesign It has the same issue that every "ordered" naming convention has. Suppose I want to introduce a "phablet" that sits between S and M. It would be hard for me to do so. |
I was going to suggest it, but I thought that it looked too crap, but have you thought about putting the min-width in the class name? eg <div class="pure-grid">
<div class="unit unit-320-1 unit-480-1-2 unit-980-1-4"></div>
</div> |
word-spacing: -0.43em; | ||
} | ||
.tablet-1-3 { | ||
width: 33.33%; } |
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.
@tilomitra how come these don't need the old IE star-hack widths, like the Grid units PR?
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.
Because they are within media queries and won't get picked up by old IEs.
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.
These are also only 2 decimals instead of 4. We need to understand what that means, and switch them back to 4 if there's no concrete for why they were switched to 2.
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.
I rounded it on purpose, based on the results of this article: http://nimbupani.com/using-decimal-percentage-values-in-responsive-design.html
The fundamental issues here are that media queries cannot be overridden, and ideally the content is driving the breakpoints. We are trying to come up with a declarative, generic solution which I think we should continue trying to come up with the best balanced solution we can. I'd like us to hold off on this and not let it block the other Grids changes we want to implement. Currently I do not like the classnames or media query values. Additionally, we're seeing that device makers are tending towards providing screens at every size, therefore there's becoming less of a gap between "phone", "tablet", and "desktop". This fact leads to content-based break points seeming to be the better approach. |
What do you mean by content-based break points? |
Creating break points which are determined by the app developer and are driven by the content the page is displaying; i.e. custom per-app. Since the range of device screen sizes is increasing and the old gaps are getting filled in, I don't think it make sense for people to use pre-determined break points. Instead they need to look at their content and decide where the break points should be based on that. |
I strongly disagree with that. We need to have sensible defaults, and people can over-ride them via the Grid Builder. I already have that functionality in there. The fact remains that the vast majority of web developers would use some sensible defaults. For those who don't want that, don't pull in |
I'm ok with adopting @bradleyfalzon's approach of using the widths in the classnames if that prevents the issue of being unsure of what values to use. It's not pretty, but it works. Personally, I think it's fine to use |
I think this sides with my point, that they are app-specific and content driven. If part of Pure's solution is to provide tooling around generating the media queries, I'm 👍 for that! Given that media queries cannot be overridden by the cascade in CSS, tooling seems like the best option to me. |
@ericf, The Grid Builder already allows you to fiddle with the media queries (click the Edit Default button under Media Queries). Once we merge this in, I can make an update to the GridBuilder to work with this grid so that upon release, we can immediately point to the Grid Builder for folks who want to customize these media queries. |
@tilomitra what about breakpoints based on rem or em and a pixel/em fallback. This could be more future save to use cause who knows where the pixel-density race will end. The current record i found is 651ppi. This would trigger tablet mode for an 1inch size display with breakpoints just defined in pixels. what do you think about rem/ems? |
@xlnt-webdesign From what I understand, targeting a That being said, I think it's a good idea for me to revisit these media queries and see how [1] http://alxgbsn.co.uk/2010/06/26/targeting-iphone-4-using-css-media-queries/ |
Yeah we should look at this. But I think if we put effort into our tooling-up of Grid Builder, then do we really need these styles. This is my point. |
We do, because the percentage of people using GridBuilder is a fraction of people using Pure. Most people using Pure will be ok with some form of media queries that works for a good subset of devices. If you don't want to use media queries, get the |
I dislike the semantic names, it is not good for current devices let alone future devices as landscape widths can overlap other devices, and naming in between such as "phablet" is ugly and limited. Names such as S, M, L is better, future proof and is NOT hard to add something in between such as xs s sm ml l xl xxl etc. |
I agree with @ericf here #149 (comment) Read this article, it has some really good points to follow: http://bradfrostweb.com/blog/post/7-habits-of-highly-effective-media-queries/ and then read about and try out this tool to help educate you better: |
Take this page for example, it uses the old way of thinking using device specific widths: http://www.governmentsecurity.org/test/example_html.html It acts like Pure does right now in the way that it collapses to 100%, if content determined the responsiveness, then this page regardless of device type, size, dpi, etc. would gracefully collapse. The articles that are currently 4 blocks wide would first collapse to 2 wide, then 1 the trending on forums section because its a slider would just get smaller until it eventually collapsed to 1 block. the code would not have to be edited and adapted every time a new device came along, or one that the design was not tested against. it would just work gracefully. |
@tilomitra, should we close this out in favor of a different approach using tooling to generate the media queries since |
I've created rework-pure-grids which allows people to generate custom unit sizes and custom media queries. It basically implements the approach described here and doesn't force Pure to have to choose a one-size-fits-all. |
Closing in favor of #267 |
This pull request is primarily for discussion purposes around the new responsive units. The entire pull request for the new grid system that I'm proposing is here: #146