Browse code

Refactored layout styles: 1. Now iPad vertical gets a collapsed sidebar with columns 2. Moved sidebar toggler styles from layout to sidebar/base 3. Added body class .sidebar-footer to support an always collapsed sidebar 4. Added $indented-lists (bool) for easily setting list indent preferences 5. Removed no-sidebar checking from sidebar-toggler, handled it through css.

Brandon Mathis authored on 18/07/2011 at 19:33:11
Showing 8 changed files
... ...
@@ -1,5 +1,5 @@
1 1
 @import "base/utilities";
2 2
 @import "base/solarized";
3 3
 @import "base/theme";
4
-@import "base/layout";
5 4
 @import "base/typography";
5
+@import "base/layout";
... ...
@@ -12,8 +12,30 @@ $sidebar-pad-medium: 15px !default;
12 12
 $sidebar-pad-wide: 20px !default;
13 13
 $sidebar-width-wide: 300px !default;
14 14
 
15
+$indented-lists: false !default;
16
+
15 17
 .group { @include pie-clearfix; }
16 18
 
19
+@mixin collapse-sidebar {
20
+  float: none;
21
+  width: auto;
22
+  clear: left;
23
+  margin: 0;
24
+  padding: 0 $pad-medium 1px;
25
+  background-color: lighten($sidebar-bg, 2);
26
+  border-top: 1px solid lighten($sidebar-border, 4);
27
+  section {
28
+    &.odd, &.even { float: left; width: 48%; }
29
+    &.odd { margin-left: 0; }
30
+    &.even { margin-left: 4%; }
31
+  }
32
+  &.thirds section {
33
+    width: 30%;
34
+    margin-left: 5%;
35
+    &.first { margin-left: 0; }
36
+  }
37
+}
38
+
17 39
 body {
18 40
   -webkit-text-size-adjust: none;
19 41
   max-width: $max-width;
... ...
@@ -43,23 +65,31 @@ body {
43 43
   }
44 44
 }
45 45
 
46
-#content {
47
-  > div, > article { width: 100%; }
48
-  > aside {
49
-    float: none;
50
-    padding: 0 $pad-min 1px;
51
-    background-color: lighten($sidebar-bg, 2);
52
-    border-top: 1px solid $sidebar-border;
53
-  }
46
+#content { > div, > article { width: 100%; }}
47
+
48
+aside[role=sidebar] {
49
+  float: none;
50
+  padding: 0 $pad-min 1px;
51
+  background-color: lighten($sidebar-bg, 2);
52
+  border-top: 1px solid $sidebar-border;
53
+  @extend .group;
54 54
 }
55 55
 
56
-.toggle-sidebar { display: none; }
56
+.toggle-sidebar { &, .no-sidebar & { display: none; }}
57
+
58
+body.sidebar-footer {
59
+  @media only screen and (min-width: 750px) {
60
+    aside[role=sidebar]{ @include collapse-sidebar; }
61
+  }
62
+  #content { margin-right: 0px; }
63
+  .toggle-sidebar { display: none; }
64
+}
57 65
 
58 66
 @media only screen and (min-width: 550px) {
59 67
   body > header { font-size: 1em; }
60
-  #content aside {
61
-    @extend .group;
62
-  }
68
+}
69
+@media only screen and (min-width: 750px) {
70
+  aside[role=sidebar] { @include collapse-sidebar; }
63 71
 }
64 72
 @media only screen and (min-width: 768px) {
65 73
   body { -webkit-text-size-adjust: auto; }
... ...
@@ -73,89 +103,28 @@ body {
73 73
     @extend .group;
74 74
     margin-right: $sidebar-width-medium;
75 75
     position: relative;
76
+    .no-sidebar & { margin-right: 0; }
77
+    .collapse-sidebar & { margin-right: 20px; }
76 78
     > div, > article {
77 79
       padding-top: $pad-medium/2;
78 80
       padding-bottom: $pad-medium/2;
79 81
       float: left;
80 82
     }
81
-    > aside {
82
-      width: $sidebar-width-medium - $sidebar-pad-medium*2;
83
-      padding: 0 $sidebar-pad-medium $sidebar-pad-medium;
84
-      background: none;
85
-      float: left;
86
-      margin: 0 -100% 0 0;
87
-      section {
88
-        width: auto; margin-left: 0;
89
-        &.odd, &.even { float: none; width: auto; margin-left: 0; }
90
-      }
91
-    }
92
-    .collapse-sidebar & {
93
-      margin-right: 20px;
94
-      > aside {
95
-        float: none;
96
-        clear: left;
97
-        width: auto;
98
-        margin: 0;
99
-        padding: 0 $pad-medium 1px;
100
-        background-color: lighten($sidebar-bg, 2);
101
-        border-top: 1px solid lighten($sidebar-border, 4);
102
-        section {
103
-          &.odd, &.even { float: left; width: 48%; }
104
-          &.odd { margin-left: 0; }
105
-          &.even { margin-left: 4%; }
106
-        }
107
-      }
108
-      > aside.thirds section {
109
-        width: 30%;
110
-        margin-left: 5%;
111
-        &.first { margin-left: 0; }
112
-      }
113
-    }
114 83
   }
115
-  .toggle-sidebar {
116
-    outline: none;
117
-    position: absolute; right: -10px; top: 0; bottom: 0;
118
-    display: inline-block;
119
-    text-decoration: none;
120
-    color: mix($text-color-light, $sidebar-bg);
121
-    width: 9px;
122
-    cursor: pointer;
123
-    &:hover {
124
-      background: mix($sidebar-border, $sidebar-bg);
125
-      @include background(linear-gradient(left, rgba($sidebar-border, .5), rgba($sidebar-border, 0)));
126
-    }
127
-    &:after {
128
-      position: absolute; right: -11px; top: 0;
129
-      width: 20px;
130
-      font-size: 1.2em;
131
-      line-height: 1.1em;
132
-      padding-bottom: .15em;
133
-      @include border-bottom-right-radius(.3em);
134
-      text-align: center;
135
-      background: $main-bg $noise-bg;
136
-      border-bottom: 1px solid $sidebar-border;
137
-      border-right: 1px solid $sidebar-border;
138
-      content: "\00BB";
139
-      text-indent: -1px;
84
+  aside[role=sidebar] {
85
+    @extend .group;
86
+    width: $sidebar-width-medium - $sidebar-pad-medium*2;
87
+    padding: 0 $sidebar-pad-medium $sidebar-pad-medium;
88
+    background: none;
89
+    clear: none;
90
+    float: left;
91
+    margin: 0 -100% 0 0;
92
+    section {
93
+      width: auto; margin-left: 0;
94
+      &.odd, &.even { float: none; width: auto; margin-left: 0; }
140 95
     }
141 96
     .collapse-sidebar & {
142
-      text-indent: 0px;
143
-      right: -20px;
144
-      width: 19px;
145
-      &:hover {
146
-        background: mix($sidebar-border, $sidebar-bg);
147
-      }
148
-      &:after {
149
-        border-left: 1px solid $sidebar-border;
150
-        text-shadow: #fff 0 1px;
151
-        content: "\00AB";
152
-        left: 0px; right: 0;
153
-        text-align: center;
154
-        text-indent: 0;
155
-        border: 0;
156
-        border-right-width: 0;
157
-        background: none;
158
-      }
97
+      @include collapse-sidebar;
159 98
     }
160 99
   }
161 100
 }
... ...
@@ -168,13 +137,19 @@ body {
168 168
       padding-top: $pad-wide/2;
169 169
       padding-bottom: $pad-wide/2;
170 170
     }
171
-    > aside {
172
-      width: $sidebar-width-wide - $sidebar-pad-wide*2;
173
-      padding: 1.2em $sidebar-pad-wide $sidebar-pad-wide;
174
-    }
175
-    .collapse-sidebar & aside {
171
+  }
172
+  aside[role=sidebar] {
173
+    width: $sidebar-width-wide - $sidebar-pad-wide*2;
174
+    padding: 1.2em $sidebar-pad-wide $sidebar-pad-wide;
175
+    .collapse-sidebar & {
176 176
       padding: { left: $pad-wide; right: $pad-wide; }
177 177
       @extend .group;
178 178
     }
179 179
   }
180 180
 }
181
+
182
+@if $indented-lists == false {
183
+  @media only screen and (min-width: 768px) {
184
+    ul, ol { margin-left: 0; }
185
+  }
186
+}
... ...
@@ -55,10 +55,15 @@ h6, section h5, section section h4, section section section h3 {
55 55
 }
56 56
 p, blockquote, ul, ol { margin-bottom: 1.5em; }
57 57
 
58
-ul{ list-style-type: circle; }
58
+ul { list-style-type: disc;
59
+  ul { list-style-type: circle;
60
+    ul { list-style-type: square; }}}
59 61
 
60
-ol{ list-style-type: decimal; ol { list-style-type: lower-alpha; } }
61
-ul ul, ol ol { margin-left: 1.75em; }
62
+ol { list-style-type: decimal;
63
+  ol { list-style-type: lower-alpha;
64
+    ol { list-style-type: lower-roman; }}}
65
+
66
+ul, ol { &, ul, ol { margin-left: 1.3em; }}
62 67
 
63 68
 strong { font-weight: bold; }
64 69
 
... ...
@@ -2,6 +2,7 @@
2 2
 // To give it a try, uncomment some of the lines below, make changes, rebuild your blog, and see how it works.
3 3
 
4 4
 //$max-width: 1350px;
5
+//$indented-lists: true;
5 6
 
6 7
 // Padding used for layout margins
7 8
 //$pad-min: 18px;
... ...
@@ -1,7 +1,2 @@
1 1
 // This File is imported last, and will override other styles in the cascade
2 2
 // Add styles here to make changes without digging in too much
3
-
4
-// For example if you want indented lists on all screen sizes uncomment the following lines
5
-// #content article {
6
-//  ul, ol { margin-left: 1.4em; }
7
-// }
... ...
@@ -1,10 +1,6 @@
1 1
 article {
2 2
   overflow: hidden;
3 3
   padding-top: 1em;
4
-  ul, ol { margin-left: 1.4em; }
5
-  @media only screen and (min-width: 768px) {
6
-    ul, ol { margin-left: 0; }
7
-  }
8 4
   header {
9 5
     position: relative;
10 6
     padding-top: 2em;
... ...
@@ -35,9 +31,9 @@ article {
35 35
   h2 {
36 36
     padding-top: 0.8em;
37 37
     background: $img-border top left repeat-x;
38
-    .entry-content &:first-child { padding-top: 0; }
39
-    &:first-child { background: none; }
40 38
   }
39
+  .entry-content & h2:first-child, header + h2 { padding-top: 0; }
40
+  h2:first-child, header + h2 { background: none; }
41 41
   .feature {
42 42
     padding-top: .5em;
43 43
     margin-bottom: 1em;
... ...
@@ -90,7 +86,9 @@ article {
90 90
 
91 91
 }
92 92
 article + article {
93
-  background: $img-border top left repeat-x;
93
+  .blog-index & {
94
+    background: $img-border top left repeat-x;
95
+  }
94 96
 }
95 97
 #content .blog-index {
96 98
   padding: { top: 0; bottom: 0; }
... ...
@@ -175,6 +175,9 @@ pre, .highlight, .gist-highlight {
175 175
 
176 176
 .highlight code { @extend .pre-code; background: #000;}
177 177
 figure[role=code] {
178
+  background: none;
179
+  padding: 0;
180
+  border: 0;
178 181
   margin-bottom: 1.5em;
179 182
   figcaption {
180 183
     position: relative;
... ...
@@ -21,6 +21,7 @@ aside[role=sidebar] {
21 21
   }
22 22
   ul {
23 23
     margin-bottom: 0.5em;
24
+    margin-left: 0;
24 25
   }
25 26
   li {
26 27
     list-style: none;
... ...
@@ -47,3 +48,52 @@ aside[role=sidebar] {
47 47
     color: $sidebar-link-color-subdued-hover;
48 48
   }
49 49
 }
50
+
51
+@media only screen and (min-width: 768px) {
52
+  .toggle-sidebar {
53
+    outline: none;
54
+    position: absolute; right: -10px; top: 0; bottom: 0;
55
+    display: inline-block;
56
+    text-decoration: none;
57
+    color: mix($text-color-light, $sidebar-bg);
58
+    width: 9px;
59
+    cursor: pointer;
60
+    &:hover {
61
+      background: mix($sidebar-border, $sidebar-bg);
62
+      @include background(linear-gradient(left, rgba($sidebar-border, .5), rgba($sidebar-border, 0)));
63
+    }
64
+    &:after {
65
+      position: absolute; right: -11px; top: 0;
66
+      width: 20px;
67
+      font-size: 1.2em;
68
+      line-height: 1.1em;
69
+      padding-bottom: .15em;
70
+      @include border-bottom-right-radius(.3em);
71
+      text-align: center;
72
+      background: $main-bg $noise-bg;
73
+      border-bottom: 1px solid $sidebar-border;
74
+      border-right: 1px solid $sidebar-border;
75
+      content: "\00BB";
76
+      text-indent: -1px;
77
+    }
78
+    .collapse-sidebar & {
79
+      text-indent: 0px;
80
+      right: -20px;
81
+      width: 19px;
82
+      &:hover {
83
+        background: mix($sidebar-border, $sidebar-bg);
84
+      }
85
+      &:after {
86
+        border-left: 1px solid $sidebar-border;
87
+        text-shadow: #fff 0 1px;
88
+        content: "\00AB";
89
+        left: 0px; right: 0;
90
+        text-align: center;
91
+        text-indent: 0;
92
+        border: 0;
93
+        border-right-width: 0;
94
+        background: none;
95
+      }
96
+    }
97
+  }
98
+}