Skip to content

Commit

Permalink
Grid documentation, styleguide cleanup, added styleguide ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
David Annez committed Feb 27, 2015
1 parent 0d8a235 commit 96c1768
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 4 deletions.
11 changes: 9 additions & 2 deletions grunt/tasks/styleguide.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,18 @@ module.exports = function(grunt){

function generateStaticContent(sections, callback) {
var pages = grunt.file.expand(staticPages).map(function(file){
var filename = path.basename(file, '.tpl').split("-"),
order = filename[0],
name = filename[1];

return {
name: humanize(path.basename(file, '.tpl')),
page: path.basename(file, 'tpl') + 'html',
name: humanize(name),
page: name + '.html',
order: order,
template: file
}
}).sort(function(a, b){
return a.order - b.order;
});

callback(null, pages.concat(sections));
Expand Down
2 changes: 2 additions & 0 deletions styleguide/assets/sass/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ $needs-font: true;
"modules/version",
"modules/logo",
"modules/nav",
"modules/grid",
"modules/code",
"modules/stats";
8 changes: 8 additions & 0 deletions styleguide/assets/sass/modules/_code.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
code {
padding: 2px 4px;
font-size: 90%;
font-family: Consolas, monospace;
color: $c-typecyan;
background-color: $c-cyan-light;
border-radius: 3px;
}
12 changes: 12 additions & 0 deletions styleguide/assets/sass/modules/_grid.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.col-example {
padding-top: 1em;
padding-bottom: 1em;
background-color: $c-cyan-light;
border: 1px solid $c-typecyan;
}

.grid-example {
.us-grid-row {
margin-bottom: $gutter-width/2;
}
}
1 change: 1 addition & 0 deletions styleguide/assets/sass/modules/_highlight.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pre code {
background: none;
margin: 0;
padding: 0;
color: $c-typegrey;
border: none;
word-wrap: normal;
max-width: initial;
Expand Down
6 changes: 5 additions & 1 deletion styleguide/assets/sass/modules/_styleguide.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ $styleguide-block-border-color: $c-bordergrey;

.styleguide {

&__block + &__block {
&__block {
padding-top: $styleguide-block-padding;
padding-bottom: $styleguide-block-padding;

&:first-child {
padding-top: 0;
}
}

&__header {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
</div>
</div>
<div class="styleguide container sidebar--push">
<h1> This is the styleguide</h1>
</div>
</div>
{{> _footer}}
Expand Down
83 changes: 83 additions & 0 deletions styleguide/static/2-grid.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<!DOCTYPE html>
<html>
<head>
{{> _head}}
</head>
<body>
<div id="wrapper">
{{> sidebar}}
<div class="us-hero trailered">
<div class="container sidebar--push styleguide__header">
<h1 class="styleguide__title">{{page.name}}</h1>
</div>
</div>
<div class="styleguide container sidebar--push">
<div class="styleguide__block">
<h2 class="styleguide__block-title">Introduction</h2>
<p>
Our grid is a 12 column grid, with similar sizes to that of Bootstrap. We also adhere to the same naming standards for device breakpoints.
</p>
<ul>
<li>Default gutter width: <strong>15px either side</strong></li>
<li>Large container width: <strong>1170px</strong></li>
<li>Desktop container width: <strong>970px</strong></li>
<li>Tablet container width: <strong>770px</strong></li>
</ul>
<ul>
<li>The parent container is <code>.us-container</code>, you must have this to start building the uSwitch layouts.</li>
<li><code>.us-grid-row</code> is then used when you are building rows of columns (gives a negative margin to the container so they align correctly)</li>
<li>All grid class names are prefixed with <code>.us-col-</code></li>
</ul>
</div>
<div class="styleguide__block">
<h2 class="styleguide__block-title">Example</h2>
<p>Here is an example of a grid which will turn into 100% width columns on mobile.</p>
<div class="grid-example">
<div class="us-grid-row">
<div class="col-example us-col-md-2">.us-col-md-2</div>
<div class="col-example us-col-md-2">.us-col-md-2</div>
<div class="col-example us-col-md-4">.us-col-md-4</div>
<div class="col-example us-col-md-4">.us-col-md-4</div>
</div>
<div class="us-grid-row">
<div class="col-example us-col-md-8">.us-col-md-8</div>
<div class="col-example us-col-md-4">.us-col-md-4</div>
</div>
<div class="us-grid-row">
<div class="col-example us-col-md-6">.us-col-md-6</div>
<div class="col-example us-col-md-6">.us-col-md-6</div>
</div>
</div>
<pre><code class="html">
&lt;div class=&quot;us-grid-row&quot;&gt;
&lt;div class=&quot;us-col-md-2&quot;&gt;.us-col-md-2&lt;/div&gt;
&lt;div class=&quot;us-col-md-2&quot;&gt;.us-col-md-2&lt;/div&gt;
&lt;div class=&quot;us-col-md-4&quot;&gt;.us-col-md-4&lt;/div&gt;
&lt;div class=&quot;us-col-md-4&quot;&gt;.us-col-md-4&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;us-grid-row&quot;&gt;
&lt;div class=&quot;us-col-md-8&quot;&gt;.us-col-md-8&lt;/div&gt;
&lt;div class=&quot;us-col-md-4&quot;&gt;.us-col-md-4&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;us-grid-row&quot;&gt;
&lt;div class=&quot;us-col-md-6&quot;&gt;.us-col-md-6&lt;/div&gt;
&lt;div class=&quot;us-col-md-6&quot;&gt;.us-col-md-6&lt;/div&gt;
&lt;/div&gt;
</code></pre>
</div>
<div class="styleguide__block">
<h2 class="styleguide__block-title">Example with mobile columns</h2>
<div class="grid-example">
<div class="us-grid-row">
<div class="col-example us-col-xsm-6 us-col-md-2">.us-col-xsm-6.us-col-md-2</div>
<div class="col-example us-col-xsm-6 us-col-md-2">.us-col-xsm-6.us-col-md-2</div>
<div class="col-example us-col-sm-6 us-col-md-4">.us-col-sm-6.us-col-md-4</div>
<div class="col-example us-col-sm-6 us-col-md-4">.us-col-sm-6.us-col-md-4</div>
</div>
</div>
</div>
</div>
</div>
{{> _footer}}
</body>
</html>
File renamed without changes.

0 comments on commit 96c1768

Please sign in to comment.