-
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
Revamp Pure Grids #146
Revamp Pure Grids #146
Conversation
See example here: jsfiddle.net/36vkC/3/ Check the src/grids/tests/manual/mobile-first.html test page for more details on how to implement this grid.
See this fiddle for more info on how this new grid system works: jsfiddle.net/36vkC/3/ This new grid system is mobile first and lets you add class names to specify how your grid will behave at different media queries. This grid breaks back-compatibility. Check the pull request for more information about that. This grid also fixes pure-css#41 through a font-size: 0; on the .pure-grid and resetting the font-size on .unit.
Wow, very nice. When and how is it decided if this is going to be fully merged? |
Hello @tilomitra. First of all, you did a great job! Secondly, is this a typo?
should be
right? |
@AurelioDeRosa Thanks, you're right! Updated. @lkraav I hope to get some feedback from you guys here. You can use this in your project right now if you pull from my |
From a users point of view, this is fantastic. We've come across a few limitations the grids here have (no offsets and no breaks), we added in this functionality ourselves - but would prefer to just use this method. Does anyone have a rough guide as to when this would get added into pure (0.3.0?), we've already began using 0.2.0, and would prefer to rewrite using this new syntax and functionality. |
@bradleyfalzon Normally, we try to ship a new version of Pure every two weeks. We just shipped a few days ago, so I would guess it'll take another 1.5 - 2 weeks, provided that we don't run into any issues. If possible, please do pull down my |
Yeah will do, we've done a fair bit already across our site, I'm working on a specific page at the moment, once that's done (won't be more than a few days tops), I'll look at trying new-grids. Looking forward to it. |
If you now use font-size: 0 hack - do you need all the letter- and word-spacings anymore?
|
@tilomitra Congratulation, this is a step in a direction I like. I know it is a hack - but incredible useful |
Mobile-first, declarative and less verbose classnames really is a step in a right direction. Looking forward to version 0.3.0. Keep up the good work guys, will test the new version asap! |
@xlnt-webdesign We already have this: https://github.com/yui/pure/pull/146/files#L4L55 |
@tilomitra Would you mind splitting this into multiple pull requests? I have questions/feedback on the classname changes, offsets, responsive classes, and the IE-specific hacks. It seems like we could split into 3-4 pull requests to keep the discussions focused. |
@msweeney No problem. Check out the pull requests that are mentioned above this comment. Looking forward to your feedback. |
Should this PR be closed then? |
@ericf Let's leave it open for now. This pull request does a nice job summarizing everything. |
Doesn't the font-size hack cause problems when setting your own font sizes? https://gist.github.com/Perturbatio/6092906 I've tried to implement the font-size changes in that Gist with the current Pure version, the text in the right hand column should be 160px |
Any ETA when the new version (0.3.0) would come out with the grid changes (mobile first and new classnames)? Do you guys need any help to speed up the process? |
@michel-tournier Currently we've been doing feature-based releases, therefore we don't have a set release schedule. We have however made a decision that the next Pure release will be 0.2.2. And at this point we're hoping to release that ASAP. |
@ericf So this grid system will not be part of the 0.2.2 release right? |
@tilomitra I just pulled down 0.3.0-rc2 and this new system was not in there. Can this and the menu get added? |
@pspeter3 We're working on getting this in for the next major Pure release. |
@tilomitra any further update on this, in regards to either syntax/functionality changes (other than what's documented in the PR) and if you have any further details on eta? Just came across another use case where this'd work brilliantly. |
@bradleyfalzon We're working on Pure Menus right now. That's what will be coming in Pure 0.4.0. This will probably land in Pure 0.5.0. You can still use this directly off the PR. What's your use case? It would be useful for us to keep use-cases in mind as we build these out. 😄 |
Thanks @tilomitra, it's a pretty typical use case, but the inner component has a fixed width <div class="pure-g-r">
<div class="pure-u-7-12">Product Name</div>
<div class="pure-u-5-12"><input><button>Add</button></div>
</div> In the future, we'd look at: <div class="pure-grid">
<div class="unit default-1 tablet-1-3 desktop-7-12">Product Name</div>
<div class="unit default-1 tablet-2-3 desktop-5-12"><input><button>Add</button></div>
</div> The product name can be quite long, so on desktops, we'd like to keep that field as long as possible (for example, we don't want to reduce the size to We'll leave it for the moment, it's only the initial unreleased feature, but we will consider merging in this PR ourselves. Our only concern is we'd already made a few changes to base pure (adding offsets ourselves for example), so it's more work than is warranted right now - but we will eventually need to do it - along with a large rewrite of |
Would be nice to add tenths to the grid units. It would only mean adding 4 new classes, but seems like tenths come up a lot when I am converting old table style layouts to Pure Grids. |
Are things progressing on the grid revamp? We're wondering if we should commit to Pure. Like what I'm seeing, but we're in need of the features that may-or-may-not be upcoming. |
@mattbaker We'll probably talk more about the Grids Revamp on the YUI Open Roundtable this Thursday at 2pm PST. We'll have it livestream on Youtube. /cc @ericf |
That would be great, where would I tune-in? Is there a specific YouTube channel to watch? |
@mattbaker It'll be live-streamed on Google+ and available later on the [YUILibrary Youtube page](p on http://www.youtube.com/yuilibrary/ and if you want,). If you can join the livestream via Google Hangout. Just add YUILibrary to your circles on Google+. |
Just confirming, the open roundtable talks re purecss were cancelled? https://www.youtube.com/watch?v=P1tc0kS1AIY |
Yeah, we had to postpone due to some last minute meeting conflicts. We are rescheduling for the upcoming Thursday. That's the 24th of October. |
@ericf and I discussed Grids at length this week and we have a good idea of what we want to do with responsive Grids in Pure, so you guys should tune in if you are interested! |
@tilomitra Thrilled to hear from you the news! |
Here's the great discussion we had a couple weeks ago where we talked through some ideas and issues with doing responsive Grids in Pure http://blog.purecss.io/post/65656116532/last-weeks-yui-open-roundtable-featured-an |
Hi guys (@tilomitra @ericf), any ETA on revamping Pure Grids? When will the new grid system be finalized? |
@michel-tournier no ETA at this time, but we discussed our plans in the link I posted above. |
Closing this now that we have #267, see the discussion there. |
This PR introduces is a pretty big change to how Grids work in Pure.
Features
pure-g
=>pure-grid
,pure-u
=>unit
, no need for.pure-g-r
)font-size: 0
hack.The rules
The rules for using the new grid is similar to the old one, with some minor differences:
pure-grid
(used to be either apure-g
or apure-g-r
)pure-grid
need to atleast have the classname ofunit
(Same as the oldpure-u
).default-*
which is the default width of an element,tablet-*
which is the width when viewed on 480px and higher, anddesktop-*
which is the width when viewed at 768px and higher. See below for more info on how these work.How it works
The new grid syntax is more simplified and less verbose. Here's how you define the simplest grid. The grid below is a non-responsive grid with two 50% units.
Responsive Behavior
One of the problems with the current grid system is that it's not really smart when it comes to responsive design. On phones, everything just collapses to 100% width, or stays the same as the desktop version. This new grid helps with that. Suppose you want something that is 25% on desktops, 50% on tablets, and 100% on phones:
The cool thing here is that you don't have to specify all 3 classnames. You only have to specify a classname when you want something to change. Suppose you have an element that you want to be 50% on phones and tablets, and only 20% on desktops:
Unlike the old grids, you don't need a
pure-g
for non-responsive elements and apure-g-r
for responsive ones. Just use apure-grid
for everything.Offsets
I also took this time to introduce offsets to grids. You can add offsets through the
offset-*
classname:Tested
This has been tested on IE7+, Latest Chrome, Safari, FF, iOS6, Android 4.0.x. The new grids has separate
*widths
and*margin-left
defined so that it works on old IEs. I had to fool around with a lot of values to get to ones that worked well.