-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy path_panel.sass
More file actions
146 lines (110 loc) · 3.13 KB
/
_panel.sass
File metadata and controls
146 lines (110 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// *************************************
//
// Panel
// -> Sticky panel
// CodePen: http://codepen.io/drewbarontini/pen/Cxuit
//
// -------------------------------------
// Template (Haml)
// -------------------------------------
//
// .panel[scroll top--1of2|...]
//
// .panel-content
// / ...
//
// *************************************
// -------------------------------------
// Functions
// -------------------------------------
// ----- Opposite Position ----- //
@function opposite-position($side)
@if $side == 'top'
@return 'bottom'
@if $side == 'bottom'
@return 'top'
@if $side == 'left'
@return 'right'
@if $side == 'right'
@return 'left'
// -------------------------------------
// Helpers
// -------------------------------------
// ----- Stretch ----- //
.stretch
bottom: 0
left: 0
position: absolute
right: 0
top: 0
// -------------------------------------
// Variables
// -------------------------------------
// ----- Breakpoints ----- //
$panel-s: 44em !default
$panel-m: 64em !default
// ----- Settings ----- //
$panel-defaults: 's' $panel-s, 'm' $panel-m !default
$panel-columns: 5 !default
// ----- Sizing ----- //
$panel-space: 1.25em !default
// -------------------------------------
// Base
// -------------------------------------
.panel
@extend .stretch
box-sizing: border-box
overflow: hidden
// -------------------------------------
// Modifiers
// -------------------------------------
// ----- Scroll ----- //
.panel--scroll
overflow: auto
// -------------------------------------
// Scaffolding
// -------------------------------------
// ----- Content ----- //
.panel-content
padding: $panel-space
// -------------------------------------
// Setup
// -------------------------------------
=panel-setup($side, $namespace: '')
// ----- One Part ----- //
.panel--#{$side}--#{$namespace}1of1
#{opposite-position($side)}: 0
// ----- Two Parts ----- //
.panel--#{$side}--#{$namespace}1of2
#{opposite-position($side)}: 50%
// ----- Three Parts ----- //
@if $panel-columns >= 3
.panel--#{$side}--#{$namespace}1of3
#{opposite-position($side)}: 66.666%
.panel--#{$side}--#{$namespace}2of3
#{opposite-position($side)}: 33.333%
// ----- Four Parts ----- //
@if $panel-columns >= 4
.panel--#{$side}--#{$namespace}1of4
#{opposite-position($side)}: 75%
.panel--#{$side}--#{$namespace}3of4
#{opposite-position($side)}: 25%
@if $panel-columns >= 5
.panel--#{$side}--#{$namespace}1of5
#{opposite-position($side)}: 80%
.panel--#{$side}--#{$namespace}2of5
#{opposite-position($side)}: 60%
.panel--#{$side}--#{$namespace}3of5
#{opposite-position($side)}: 40%
.panel--#{$side}--#{$namespace}4of5
#{opposite-position($side)}: 20%
// -------------------------------------
// Creation
// -------------------------------------
$panel-sides: top, right, bottom, left
@each $side in $panel-sides
+panel-setup($side)
@each $device in $panel-defaults
@media screen and (min-width: nth($device, 2))
@each $side in $panel-sides
+panel-setup($side, "#{nth($device, 1)}--")