Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'grids' into dev-3.x

  • Loading branch information...
commit 9d5a564b726b23e39d5480215253d1a11b112d62 2 parents 9d69ddd + 059eda9
@tilomitra tilomitra authored
View
7 src/cssgrids/build.json
@@ -16,6 +16,13 @@
"cssfiles": [
"cssgrids-base.css"
]
+ },
+ "cssgrids-responsive": {
+ "cssfiles": [
+ "cssgrids-base.css",
+ "cssgrids-units.css",
+ "cssgrids-responsive-base.css"
+ ]
}
}
}
View
44 src/cssgrids/css/cssgrids-responsive-base.css
@@ -0,0 +1,44 @@
+.yui3-g-r {
+ letter-spacing: -0.31em;
+ *letter-spacing: normal;
+ word-spacing: -0.43em;
+}
+.yui3-g-r img {
+ max-width: 100%;
+}
+
+@media (min-width:980px) {
+ .yui3-visible-phone {
+ display: none;
+ }
+ .yui3-visible-tablet {
+ display: none;
+ }
+ .yui3-hidden-desktop {
+ display: none;
+ }
+}
+@media (max-width:480px) {
+ .yui3-g-r > [class ^= "yui3-u"] {
+ width: 100%;
+ }
+}
+@media (max-width:767px) {
+ .yui3-g-r > [class ^= "yui3-u"] {
+ width: 100%;
+ }
+ .yui3-hidden-phone {
+ display: none;
+ }
+ .yui3-visible-desktop {
+ display: none;
+ }
+}
+@media (min-width:768px) and (max-width:979px) {
+ .yui3-hidden-tablet {
+ display: none;
+ }
+ .yui3-visible-desktop {
+ display: none;
+ }
+}
View
16 src/cssgrids/docs/assets/cssgrids-magazine-tests.js
@@ -0,0 +1,16 @@
+YUI.add('cssgrids-magazine-tests', function(Y) {
+
+ var suite = new Y.Test.Suite('cssgrids-magazine example test suite'),
+ Assert = Y.Assert;
+
+ suite.add(new Y.Test.Case({
+ name: 'Responsive tests',
+ 'images have max-widths defined': function() {
+ var headlineImg = Y.one('.left-bar .article img');
+ Assert.isNotUndefined(headlineImg.getComputedStyle('maxWidth'), 'maxWidth undefined on images');
+ }
+ }));
+
+ Y.Test.Runner.add(suite);
+
+}, '', { requires: [ 'node', 'node-event-simulate' ] });
View
16 src/cssgrids/docs/component.json
@@ -51,6 +51,17 @@
"tags" : ["cssgrids"],
"hideTableOfContents": true
+ },
+
+ {
+ "newWindow" : "true",
+ "name" : "cssgrids-magazine",
+ "displayName": "Responsive Newspaper Layout",
+ "description": "A responsive layout that looks like a newspaper",
+ "modules" : ["cssgrids"],
+ "tags" : ["cssgrids"],
+
+ "hideTableOfContents": true
}
],
@@ -78,6 +89,11 @@
"name" : "cssgrids-align",
"displayName": "CSS Grids Alignment Example",
"layout" : "cssgrids-align-example"
+ },
+ "cssgrids-magazine-example": {
+ "name" : "cssgrids-magazine",
+ "displayName": "CSS Grids Responsive Magazine Example",
+ "layout" : "cssgrids-magazine-example"
}
}
}
View
2  src/cssgrids/docs/cssgrids-magazine-example.mustache
@@ -0,0 +1,2 @@
+{{>cssgrids-magazine-source}}
+{{>test-runner}}
View
10 src/cssgrids/docs/cssgrids-magazine.mustache
@@ -0,0 +1,10 @@
+<div class="intro">
+ <p>The HTML for this example uses YUI3 Responsive Grids syntax to look great on different screen sizes (resize this page or view it on a smartphone). On larger screens, there are three columns. However, if viewed on a screen that is smaller than 767px, the columns stack vertically. The right-most column, which shows a stack of content on larger widths, changes to show a grid on smaller widths.</p>
+</div>
+
+<div class="example newwindow">
+ <a href="cssgrids-magazine-example.html" target="_blank" class="button">
+ View Example in New Window
+ </a>
+</div>
+
View
127 src/cssgrids/docs/index.mustache
@@ -14,8 +14,13 @@
```
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/{{yuiVersion}}/build/cssgrids/grids-min.css">
```
+ <p>If you want responsive behavior, pull down <a href="#responsive">Responsive Grids</a> instead.</p>
- <h2 id="using">Using YUI CSS Grids</h2>
+
+
+
+
+ <h2 id="using">Using YUI CSS Grids</h2>
<h3>Unit Sizes</h3>
<p>All of the sizing for YUI Grids is done using "units". Units can be subdivided up to 1/24 of the available width. The following table gives the various unit classes that can be applied.</p>
@@ -214,3 +219,123 @@ body {
</div>
</body>
```
+
+```
+<head>
+ <style>
+ body {
+ margin: auto; /* center in viewport */
+ width: 960px;
+ }
+
+ #nav {
+ width: 200px;
+ }
+
+ #main {
+ width: 760px;
+ }
+
+ </style>
+</head>
+
+<body>
+ <div class="yui3-g">
+ <div class="yui3-u" id="nav">
+
+ </div>
+ <div class="yui3-u" id="main">
+
+ </div>
+ </div>
+</body>
+```
+
+
+ <h2 id="responsive">Responsive Grids</h2>
+
+ <p>To pull down Responsive Grids, include this link element on your page:</p>
+```
+<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/{{yuiVersion}}/build/cssgrids-responsive/cssgrids-responsive-min.css">
+```
+
+ <p>YUI Responsive Grids builds on top of the existing YUI Grids implementation. It adds a single new class name called `.yui3-g-r`. You can use this instead of using `.yui3-g` as you normally do. All elements with a class name of `.yui3-u-*-*` will automatically become responsive if they are direct descendents of a `.yui3-g-r`. Images will shrink to fit the viewport, and units will collapse to 100% width when the viewport is 767px or below.</p>
+
+ <p>For example, consider the two HTML snippets below. The first gist shows how regular YUI grids are written. These grids are unresponsive. They’ll always be one-thirds irrespective of the width of the screen. The second gist replaces the `yui3-g` with `yui3-g-r`, thereby making the one-third columns collapse to full width on lower screen widths.</p>
+
+```
+<div class='yui3-g'>
+ <div class="yui3-u-1-3">...</div>
+ <div class="yui3-u-1-3">...</div>
+ <div class="yui3-u-1-3">...</div>
+</div>
+
+```
+
+```
+<div class='yui3-g-r'>
+ <div class="yui3-u-1-3">...</div>
+ <div class="yui3-u-1-3">...</div>
+ <div class="yui3-u-1-3">...</div>
+</div>
+```
+
+ <p>If you want some HTML elements to remain in a grid even on smaller screens, wrap them in the standard `.yui3-g`</p>
+
+
+ <h3>Media Queries</h3>
+
+ <p>Responsive Grids listens to the following media queries. All `yui3-u-*` elements inside a `yui3-g-r` become 100% width at 767px or below.</p>
+
+ <table>
+ <thead>
+ <tr>
+ <th>Type of Display</th>
+ <th>Media Query Widths</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>Default Displays</td>
+ <td>980px and up</td>
+ </tr>
+ <tr>
+ <td>Large Tablets</td>
+ <td>768px to 979px</td>
+ </tr>
+ <tr>
+ <td>Smaller Tablets and Large Phones</td>
+ <td>767px and below</td>
+ </tr>
+ <tr>
+ <td>Phones</td>
+ <td>480px and below</td>
+ </tr>
+ </tbody>
+ </table>
+
+ <p>Responsive Grids also comes with the following helper classes to show or hide content at different screen widths. Remember that to optimize performance and page load time, you should ideally determine what to show and hide on the server, instead of on the client.</p>
+
+ <table>
+ <thead>
+ <tr>
+ <th>Helper Class Name</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>`yui3-hidden-phone`</td>
+ <td>Content marked with this class will be hidden below 768px</td>
+ </tr>
+ <tr>
+ <td>`yui3-hidden-tablet`</td>
+ <td>Content marked with this class will be hidden between 768px and 979px</td>
+ </tr>
+ <tr>
+ <td>`yui3-hidden-desktop`</td>
+ <td>Content marked with this class will be hidden above 980px</td>
+ </tr>
+ </tbody>
+ </table>
+
View
184 src/cssgrids/docs/partials/cssgrids-magazine-source.mustache
@@ -0,0 +1,184 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <meta charset='utf-8'>
+ <meta name = "viewport" content = "width = device-width">
+ <link rel="stylesheet" type="text/css" href="http://necolas.github.com/normalize.css/2.0.1/normalize.css">
+ <link rel="stylesheet" href="{{yuiBuildUrl}}/cssgrids-responsive/cssgrids-responsive.css" type="text/css">
+ <script src="{{yuiSeedUrl}}"></script>
+ <style>
+
+ body {
+ font-family: serif;
+ }
+ .header {
+ font-family: sans-serif;
+ background: black;
+ min-height: 150px;
+ margin: 0;
+ color:white;
+ padding: 30px 20px;
+ }
+ .header h2 {
+ font-weight:300;
+ color: #666;
+ margin:0;
+ font-family: sans-serif;
+ }
+
+ .blurb {
+ font-family: sans-serif;
+ border-bottom:1px solid #ccc;
+ }
+ .blurb p {
+ line-height: 1.6em;
+ font-size: 1em;
+ }
+
+ p {
+ color: #333;
+ font-size: 1.1em;
+ }
+
+ h3 {
+ font-size:1.2em;
+ letter-spacing: -0.05em;
+ margin-bottom: 10px;
+ }
+
+ h4 {
+ color: #9B1518;
+ font: normal 0.5em/1.3 Helvetica, Arial, sans-serif;
+ letter-spacing: 0.01em;
+ text-transform: uppercase;
+ margin-bottom: .4em;
+ }
+ .content {
+ padding: 15px;
+ }
+
+ .article {
+ border-bottom: 1px solid #ddd;
+ padding: 0 5px 15px 5px;
+ }
+
+ .floatLeft {
+ float:left;
+ margin: 25px 10px 3px 0;
+ }
+
+ .right-bar .article {
+ text-align: center;
+ padding:15px;
+ }
+ .right-bar h3 {
+ color: #333;
+ font-family: 1em;
+ font-weight: normal;
+ margin-top:0.3em;
+ }
+ .section-header {
+ color: #AA0016;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 1.3em;
+ margin-bottom:0.2em;
+ padding-bottom:0.5em;
+ border-bottom:1px solid #ddd;
+ margin-top:1em;
+ font-style: normal;
+ font-variant: normal;
+ }
+
+ @media (max-width: 767px) {
+
+ .header {
+ text-align: center;
+ }
+
+ .headline h3 {
+ font-size:180%;
+ }
+
+ .right-bar .article {
+ display:inline-block;
+ width:30%;
+ padding:0;
+ border:none;
+ }
+ }
+ </style>
+</head>
+<body>
+ <div class="yui3-g-r">
+ <div class="yui3-u-1-2 left-bar">
+ <div class="yui3-u-1 content">
+
+ <div class='yui3-u-1 headline article'>
+ <img src="http://c.o0bg.com/rf/image_585w/Boston/2011-2020/2012/11/19/BostonGlobe.com/Lifestyle/Images/Credit_Hilda_Grahnat.jpg">
+ <h3 class='yui3-u-1'>The unstyled look of hipster food magazines</h3>
+ <p>The latest trendy food and lifestyle magazines are driven by a desire to exist outside the mainstream food world and all that goes with it.</p>
+ </div>
+
+ <div class='yui3-u-1 article'>
+ <div class='yui3-g'>
+ <h3 class='yui3-u'>A free market will help fix health care</h3>
+ <img class='floatLeft' src="http://c.o0bg.com/rf/image_90x90/Boston/2011-2020/2012/11/28/BostonGlobe.com/EditorialOpinion/Images/jacoby-280.jpg">
+ <div class='yui3-u-1'>
+ <p>What Medicare needs is not more top-down control, but the flexibility and competition of a consumer-driven free market.</p>
+ </div>
+ </div>
+ </div>
+
+
+ <div class='yui3-u-1 article'>
+ <div class='yui3-g'>
+ <h3 class='yui3-u'>Boston's last great unsolved mystery</h3>
+ <img class='floatLeft' src="http://c.o0bg.com/rf/image_90x90/Boston/2011-2020/2012/11/16/BostonGlobe.com/Arts/Images/ryan_gardner-museum14_trave-1399.jpg">
+ <div class='yui3-u-1'>
+ <p>In 1990, Boston’s Isabella Stewart Gardner Museum was robbed of 13 works of art. In this special section, delve into the Globe’s re-examination of the case.</p>
+ </div>
+ </div>
+ </div>
+
+ </div>
+ </div>
+ <div class="yui3-u-1-5 center-bar">
+ <div class='yui3-u-1 content'>
+ <h1 class='yui3-u-1 section-header'>Latest News</h1>
+ <div class='yui3-u-1 article'>
+ <h2>Health chief cites 'serious lapses' at state drug lab</h2>
+ <p>The health secretary said lab management failed to alert the state after discovering a “serious breach of protocol” by a chemist.</p>
+ </div>
+ <div class='yui3-u-1 article'>
+ <h2>Patrick addresses controversies on drug lab, hiring</h2>
+ <p>Governor Patrick said a former highway safety chief with a bad driving record made his administration look “ridiculous.”</p>
+ </div>
+ <div class='yui3-u-1 article'>
+ <h2>Powerball jackpot up to $550m</h2>
+ <p>The fast-growing jackpot had been $450 million as recently as Tuesday morning.</p>
+ </div>
+ </div>
+ </div>
+ <div class="yui3-u-1-4 right-bar">
+ <div class='yui3-u-1 content'>
+ <h1 class='yui3-u-1 section-header'>Globe Exclusives</h1>
+ <div class='yui3-u-1 article'>
+ <img src="http://c.o0bg.com/rf/image_150x150/Boston/Library/Staff/Caricatures/lehigh.png">
+ <h4>Scot Lehigh</h4>
+ <h3>End of the Menino era?</h3>
+ </div>
+ <div class='yui3-u-1 article'>
+ <img src="http://c.o0bg.com/rf/image_150x150/Boston/2011-2020/2012/11/28/BostonGlobe.com/Business/Images/Suffolk%20Classroom%20Building--150x150.jpg">
+ <h3>Suffolk shifts core of campus downtown</h3>
+ </div>
+ <div class='yui3-u-1 article'>
+ <img src="http://c.o0bg.com/rf/image_150x150/Boston/2011-2020/2011/12/08/BostonGlobe.com/Metro/Images/GlobeSantaLogoNew--150x150.jpg">
+ <h3>How to donate to Globe Santa</h3>
+ </div>
+ </div>
+ </div>
+ </div>
+
+</body>
+</html>
View
13 src/cssgrids/meta/cssgrids.json
@@ -19,6 +19,19 @@
"type": "css"
},
+ "cssgrids-responsive": {
+ "requires": [
+ "cssgrids",
+ "cssgrids-responsive-base"
+ ],
+
+ "optional": [
+ "cssreset",
+ "cssfonts"
+ ],
+ "type": "css"
+ },
+
"cssgrids": {
"optional": [
"cssreset",
View
175 src/cssgrids/tests/manual/responsive.html
@@ -0,0 +1,175 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <link rel="stylesheet" type="text/css" href="../../../../build/cssgrids-responsive/cssgrids-responsive.css">
+ <title></title>
+</head>
+<body class="yui3-g-r">
+
+ <div class="header yui3-u-1">
+
+ <h1 class="yui3-u-1">YUI3 Responsive Grids</h1>
+ <h2 class="yui3-u">An example of making your YUI3 Grids behave responsively.</h2>
+
+ </div>
+
+ <div class='yui3-g'>
+ <h1 class="yui3-u-1 centered">How does it work?</h1>
+ <div class='yui3-u-1'>
+ <div class='cell'>
+ <p>YUI3 Responsive Grids builds on top of the existing YUI3 Grids implementation. It adds a single new class name called <code>.yui3-g-r</code>. You can use this instead of using <code>.yui3-g</code> as you normally do. All elements with a class name of <code>.yui3-u-*-*</code> will automatically become responsive if they are direct descendents of a <code>.yui3-g-r.</code></p>
+
+ <h2>The HTML</h2>
+ <p>The first gist shows how regular YUI3 grids are written. These grids are unresponsive. They'll always be one-thirds irrespective of the width of the screen. The second gist replaces the <code>yui3-g</code> with <code>yui3-g-r</code>, thereby making the one-third columns collapse to full width on lower screen widths.</p>
+ <script src="https://gist.github.com/3955432.js"></script>
+ </div>
+ </div>
+
+
+ <h1 class="yui3-u-1 centered">Features.</h1>
+ <div class="yui3-u-1">
+ <div class="cell">
+ <ul>
+ <li>Adds configurable media queries for different screen widths (Desktops, Landscape Tablets, Portrait Tablets, Phones)</li>
+ <li>Collapses elements to 100% if smaller than a certain width (767px by default)</li>
+ <li>Adjusts images to fit on smaller screens</li>
+ <li>Works with as many columns as you want (or as few)</li>
+ </div>
+ </div>
+
+ </div>
+
+ <div class="yui3-g-r">
+ <h1 class="yui3-u-1 centered">Example.</h1>
+ <div class="yui3-u-1-4">
+ <div class="cell">
+ <h3>Fast</h3>
+ <p>YUI's lightweight core and modular architecture make it scalable, fast, and robust. Built by frontend engineers at Yahoo!, YUI powers the most popular websites in the world.</p>
+ </div>
+ </div><!--/span-->
+
+ <div class="yui3-u-1-4">
+ <div class="cell">
+ <h3>Complete</h3>
+ <p>YUI's intuitive and well-documented API takes you from basic DOM handling to building performant and maintainable applications on desktop browsers, mobile devices, and servers.</p>
+ </div>
+ </div><!--/span-->
+ <div class="yui3-u-1-4">
+ <div class="cell">
+ <h3>Industrial Strength</h3>
+ <p>A thriving community, a carefully architected infrastructure, and a comprehensive suite of tools help you code like a pro, from simple web pages to complex web applications.</p>
+ </div>
+ </div><!--/span-->
+ <div class="yui3-u-1-4">
+ <div class="cell">
+ <h3>Free and Open</h3>
+ <p>YUI is free for all uses and is developed in the open on GitHub. Core team members can always be found in the forums and the #yui IRC channel on Freenode. Pull requests welcome!</p>
+ </div>
+ </div><!--/span-->
+
+ <div class="yui3-u-1 centered">
+ <img class="yui3-u" src="http://lorempixel.com/800/400/" alt="test image">
+ </div>
+
+ <div class="yui3-u-2-5">
+ <div class="cell">
+ <h3>Two-Fifth Column</h3>
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur fermentum dui turpis. Duis nulla dolor, suscipit in venenatis vitae, auctor eu nibh. Proin lobortis arcu nec tellus vehicula vitae pellentesque nisi molestie. Aenean felis ligula, hendrerit id dictum sed, ornare nec leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec non lectus et quam porttitor dignissim vitae ac odio. Aenean mattis dui porta lacus egestas ultricies. Mauris vel dolor libero, sit amet rhoncus nibh.</p>
+ </div>
+ </div>
+
+ <div class="yui3-u-3-5">
+ <div class="cell">
+ <h3>Three-Fifth Column</h3>
+ <p>Quisque ac magna eget est porta varius ut eget quam. Curabitur tincidunt gravida nisl, vitae luctus velit vulputate vel. Aliquam sed sodales orci. Proin varius placerat magna tristique tincidunt. Morbi non dignissim felis. Proin bibendum libero nec felis eleifend porttitor. Morbi auctor venenatis justo, molestie luctus mi pulvinar nec. Pellentesque vitae ornare lacus. Nulla hendrerit tempor auctor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis luctus facilisis cursus. Integer in lacinia dui. Phasellus ullamcorper, sem at congue pretium, velit sapien ornare mi, eu eleifend risus sapien ac eros.</p>
+
+ <p>Fusce accumsan, sem vitae tempus tempor, nulla lectus interdum felis, eget molestie urna mauris vel elit. Curabitur vel ipsum nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam viverra, augue et sollicitudin dignissim, lectus tellus imperdiet lectus, a tempor ipsum mauris vitae augue. Nullam vel nulla a purus cursus consequat. Nulla orci elit, malesuada nec egestas non, ornare quis nibh. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>
+ </div>
+ </div>
+ </div>
+ <div class='yui3-g'>
+ <h1 class="yui3-u-1 centered">Grids on mobile</h1>
+ <div class="yui3-u-1-3">
+ <div class="cell">
+ <h4>Thirds</h4>
+ <p>This cell will be a grid even on mobile devices.</p>
+ </div>
+ </div>
+ <div class="yui3-u-1-3">
+ <div class="cell">
+ <h4>Thirds</h4>
+ <p>This cell will be a grid even on mobile devices.</p>
+ </div>
+ </div>
+ <div class="yui3-u-1-3">
+ <div class="cell">
+ <h4>Thirds</h4>
+ <p>This cell will be a grid even on mobile devices.</p>
+ </div>
+ </div>
+ </div>
+ <div class='yui3-g'>
+ <div class="yui3-u-1-3">
+ <div class="cell">
+ <h4>Thirds</h4>
+ <p>This cell will be a grid even on mobile devices.</p>
+ </div>
+ </div>
+ <div class="yui3-u-1-3">
+ <div class="cell">
+ <h4>Thirds</h4>
+ <p>This cell will be a grid even on mobile devices.</p>
+ </div>
+ </div>
+ <div class="yui3-u-1-3">
+ <div class="cell">
+ <h4>Thirds</h4>
+ <p>This cell will be a grid even on mobile devices.</p>
+ </div>
+ </div>
+ </div>
+ <div class='yui3-g'>
+ <div class="yui3-u-1-3">
+ <div class="cell">
+ <h4>Thirds</h4>
+ <p>This cell will be a grid even on mobile devices.</p>
+ </div>
+ </div>
+ <div class="yui3-u-1-3">
+ <div class="cell">
+ <h4>Thirds</h4>
+ <p>This cell will be a grid even on mobile devices.</p>
+ </div>
+ </div>
+ <div class="yui3-u-1-3">
+ <div class="cell">
+ <h4>Thirds</h4>
+ <p>This cell will be a grid even on mobile devices.</p>
+ </div>
+ </div>
+ </div>
+
+
+ <div class='yui3-g-r'>
+ <h1 class="yui3-u-1 centered">Helper Classes</h1>
+ <div class="yui3-u-1 yui3-hidden-phone">
+ <div class="cell">
+ <h4>No Phones Allowed</h4>
+ <p>Should be hidden on phones</p>
+ </div>
+ </div>
+ <div class="yui3-u-1 yui3-hidden-tablet">
+ <div class="cell">
+ <h4>No Tablets Allowed</h4>
+ <p>Should be hidden on tablets</p>
+ </div>
+ </div>
+ <div class="yui3-u-1 yui3-hidden-desktop">
+ <div class="cell">
+ <h4>No big screens allowed.</h4>
+ <p>Should be hidden on desktops/laptops</p>
+ </div>
+ </div>
+ </div>
+</body>
+</html>
Please sign in to comment.
Something went wrong with that request. Please try again.