summaryrefslogtreecommitdiff
path: root/app/assets/stylesheets/vendor/survival-kit/_navigation.scss
blob: 5e6f13d29328da4822e1fc48c2c82b164b8d1610 (plain)
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
// Survival ✚ Kit

// Horizontal Navigation Low-level Method.
//
// It's meant to be called from other predifined mixins to avoid calling so many variables per call.
// Used from ul/ol
@mixin horizontal-navigation(
    $height,
    $color,
    $hover-color,
    $active-color,
    $text-shadow,
    $bg,
    $bg-hover,
    $bg-active,
    $box-shadow,
    $box-shadow-hover,
    $box-shadow-active,
    $border-left,
    $border-right,
    $padding,
    $margin,
    $border-radius,
    $font-weight,
    $font-size,
    $tab-space // Sets a tabbing space.
  ) {
  // $bg none or transparent will remove the background.
  @if $tab-space == none { $tab-space:0;}
  @if $bg == none { $bg:transparent;}
	@if $bg-active == auto { $bg-active:$bg-hover; }
	@if $active-color == auto { $active-color:$hover-color; }

  // Border Calculation
  // ----------------------------------------
  // Check if borders are set to anything but none / auto.
  @if $border-left != none and $border-right != none and $border-left != auto and $border-right != auto {
    // Borders where explicitly set.
    @include _sk-nav-borders($border-left, $border-right);
  } @else if $border-left == auto and $border-right == auto and $bg != transparent{
    // Borders calculated magically.
    @include _sk-nav-borders(lighten($bg, 10%), darken($bg, 10%));
  }

  height:$height; // instead of clearfix, to keep shadows alive.
  margin: 0;
  list-style:none;

  // Links and input
  li, a {
    display:block;
    float:left;  // this can make it inline or block level.
    line-height:$height;
  }


  a {
    @if $font-weight != none {
      font-weight: $font-weight;
    }
    @if $padding != none {
      padding:$padding;
    }
    @if $margin != none {
      margin:$margin;
    }
    @if $font-size != none {
      font-size:$font-size;
    }

    text-decoration:none;
    color:$color;

    @if $bg != transparent {
      background:$bg;
    }

    @if $box-shadow != none {
      @include box-shadow($box-shadow);
    }

    @if $text-shadow != none {
      @include text-shadow($text-shadow, 1px, 1px, 1px);
    }

    @if $border-radius != none {
      @include border-radius($border-radius);
    }

    // Feature for tabs.
    @if $tab-space != 0 {
      margin-top: -($tab-space);
    }

    // States
    // ----------------------------------------

    &:hover{
      @include _sk-nav-effects($hover-color, $bg-hover, $text-shadow, $box-shadow-hover, $bg-hover);
      text-decoration:none;
    }

    &:visited {
      color:$active-color;
    }
    &.active {
      @include _sk-nav-effects($active-color, $bg-active, $text-shadow, $box-shadow-active, $bg-hover);
      // Add tab space.
      @if $tab-space != 0 {
        height:$height + $tab-space;
      }
    }
  }
}

// Mixin used to generate Background effects by the horizontal-navigation mixin.
@mixin _sk-nav-effects($color, $bg, $text-shadow, $box-shadow, $bg-hover) {
	@if $color != auto {
	  color:$color;
	}
  @if $bg != transparent {
    @if $bg-hover == auto {
       background:darken($bg,3%);
    } @else {
      background:$bg;
    }
    @if $box-shadow != none{
      @include box-shadow($box-shadow);
    }
  }
  // Remove the text shadow of hover.
  @if $text-shadow != none {
    @include text-shadow(none);
  }
}

// Low level mixin.
// Invoked by other mixins.
//
// @var $left the left border.
// @var $right the right border
@mixin _sk-nav-borders($left, $right) {
  li:first-child, li.first {
    border-left:1px solid $right;
  }// li:first-child
  li:last-child, li.last {
    border-right:1px solid $left;
  }
  a {
    border:{
      left: 1px solid $left;
      right: 1px solid $right;
    };
    &.active, &.active:hover {
      border:{
        left:1px solid transparent;
        right:1px solid transparent;
      };
    }
    &:hover {
      border:{
        left:1px solid transparent;
        right:1px solid transparent;
      };
    }
  }
}

//
// @TODO: Add docs to tabs!
//
@mixin navigation-classes($opts: tabs) {
  $opts: join($opts, force list);
  .nav {
    list-style: none;
    margin-bottom: $base-line-height;
    margin-left: 0;
  }

  // Make links block level
  .nav > li > a {
    display: block;
  }
  .nav > li > a:hover {
    background-color: #EEEEEE;
    text-decoration: none;
  }

  // Common styles
  .nav-tabs {
    @extend .nav;
    @include pie-clearfix();
  }
  .nav-tabs > li, .nav-pills > li {
    float: left;
  }
  .nav-tabs > li > a {
    line-height: 14px;
    margin-right: 2px;
    padding-left: 12px;
    padding-right: 12px; // keeps the overall height an even number
  }

  .nav-tabs {
    border-bottom: 1px solid #ddd;
  }

  .nav-tabs > li {
    margin-bottom: -1px;
  }

  .nav-tabs > li > a {
    @include border-radius(4px 4px 0 0);
    border: 1px solid transparent;
    padding-bottom: 9px;
    padding-top: 9px;
    &:hover {
      border-color: #EEEEEE #EEEEEE #ddd;
    }
  }
  .nav-tabs > .active {
    a, a:hover {
      background-color: #FFF;
      border: 1px solid #ddd;
      border-bottom-color: transparent;
      color: gray;
      cursor: default;
    }
  }
}