aboutsummaryrefslogtreecommitdiffstats
path: root/web/cobrands/sass/_mixins.scss
blob: 6d4f523ce0117146a9d652f716e3e9852e6a8313 (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
$direction: 'left' !default;

// Button reset
// Uses !important a few times to quickly reset
// styles from a:link, a:hover, a:visited etc.
@mixin button-reset($bg-top: #fff, $bg-bottom: #eee, $border: #ccc, $text: inherit, $hover-bg-bottom: #e9e9e9, $hover-bg-top: #f9f9f9, $hover-border: #ccc, $hover-text: inherit){
  display: inline-block;
  margin: 0;
  padding: 0.75em 1em;
  width: auto;
  height: auto;
  vertical-align: top;
  text-align: center;

  font-size: 1em;
  line-height: 1em;
  font-weight: bold;
  font-family: inherit;
  text-decoration: none !important;
  color: $text !important;

  cursor: pointer;
  background: $bg-bottom;
  @include linear-gradient($bg-top, $bg-bottom);

  border: 1px solid $border;
  @include border-radius(4px);

  &:hover,
  &:focus {
    background: $hover-bg-bottom;
    @include linear-gradient($hover-bg-top, $hover-bg-bottom);
    text-decoration: none !important;
    border-color: $hover-border;
    color: $hover-text !important;
  }

  &:disabled {
    background: $bg-bottom;
    border-color: $border;
    color: desaturate(darken($bg-bottom, 50%), 50%) !important;
    cursor: default;
  }
}

// list reset
@mixin list-reset-soft {
  list-style-type:none;
  padding: 0;
  margin: 0;
  li{
    list-style-type:none;
    padding: 0;
    margin: 0;
    border: 0;
  }
}

// LTR / RTL
$left: left;
@if $direction == right {
  $left: right;
}

$right: right;
@if $direction == right {
  $right: left;
}

@function flip($ltr, $rtl) {
    @if $direction == left {
        @return $ltr;
    } @else {
        @return $rtl;
    }
}

// Compass-like mixins

@mixin box-sizing($bs) {
  $bs: unquote($bs);
  @include experimental(box-sizing, $bs, -moz, -webkit, not -o, not -ms, official);
}

@mixin border-radius($radius: 5px) {
  @include experimental(border-radius, $radius, -moz, -webkit, not -o, not -ms, official);
}

@mixin box-shadow($shadows...) {
  @include experimental(box-shadow, $shadows, -moz, -webkit, not -o, not -ms, official);
}

@mixin experimental($property, $value, $moz: true, $webkit: true, $o: true, $ms: true, $official: true) {
  @if $webkit   { -webkit-#{$property} : #{$value}; }
  @if $moz      {    -moz-#{$property} : #{$value}; }
  @if $ms       {     -ms-#{$property} : #{$value}; }
  @if $o        {      -o-#{$property} : #{$value}; }
  @if $official {         #{$property} : #{$value}; }
}

@mixin inline-block($alignment: middle) {
  display: inline-block;
  vertical-align: middle;
  *vertical-align: auto;
  zoom: 1;
  *display: inline;
}

@mixin clearfix {
    &:before, &:after { content: " "; display: table; }
    &:after { clear: both; }
    & { *zoom: 1; }
}

@mixin linear-gradient($stops...) {
  $webkit-gradient-stops: ();
  $webkit-end-point: 100%;
  @each $stop in $stops {
    $pos: none;
    @if length($stop) > 1 {
      @if length($stops) == 2 && unit(nth($stop, 2)) == 'px' {
        $webkit-end-point: nth($stop, 2);
        $pos: 100%;
      } @else {
        $pos: nth($stop, 2);
      }
    } @else if (length($stop) == 1 && index($stops, $stop) == 1) {
      $pos: 0%;
    } @else {
      $pos: 100%;
    }
    $webkit-gradient-stops: append($webkit-gradient-stops,
                                   color-stop($pos, nth($stop, 1)),
                                   comma);
  }

  background: -webkit-gradient(linear, 0% 0%, 0% $webkit-end-point, $webkit-gradient-stops);
  @each $prefix in -moz-, -o-, -webkit-, "" {
    background: #{$prefix}linear-gradient($stops);
  }
}

@mixin flex-container() {
  display: -webkit-box;
  display: -moz-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
}

@mixin flex($values, $values2009: 0) {
  -webkit-box-flex: $values2009;
  -moz-box-flex: $values2009;
  -webkit-box-flex: $values;
  -moz-box-flex: $values;
  -webkit-flex: $values;
  -ms-flex: $values;
  flex: $values;
}

@mixin flex-align($alignment) {
  -webkit-box-align: $alignment;
  -webkit-align-items: $alignment;
  -ms-flex-align: $alignment;
  align-items: $alignment;
}