_mixins.scss 3.88 KB
Newer Older
1 2 3
// lms - utilities - mixins and extends
// ====================

4 5 6
// mixins - font sizing
@mixin font-size($sizeValue: 16){
  font-size: $sizeValue + px;
7
 // font-size: ($sizeValue/10) + rem;
8 9
}

10 11 12
// mixins - line height
@mixin line-height($fontSize: auto){
  line-height: ($fontSize*1.48) + px;
13
 // line-height: (($fontSize/10)*1.48) + rem;
14 15
}

16 17 18 19
// image-replacement hidden text
@mixin text-hide() {
  text-indent: 100%;
  white-space: nowrap;
20
  overflow: hidden;
21 22
}

Galen Frechette committed
23 24 25
@mixin vertically-and-horizontally-centered ( $height, $width ) {
  left: 50%;
  margin-left: -$width / 2;
Galen Frechette committed
26
  //margin-top: -$height / 2;
Galen Frechette committed
27 28
  min-height: $height;
  min-width: $width;
Galen Frechette committed
29 30
  position: absolute;
  top: 150px;
Galen Frechette committed
31
}
32 33 34 35 36 37 38

// sunsetted, but still used mixins
@mixin hide-text(){
  text-indent: -9999px;
  overflow: hidden;
  display: block;
}
39

40 41 42 43 44 45
@mixin show-hover-state() {
    opacity: 1;
    background-color: $shadow-d2;
    border-radius: ($baseline/4);
}

46 47 48 49
@function em($pxval, $base: 16) {
  @return #{$pxval / $base}em;
}

50
// line-height
51 52 53 54
@function lh($amount: 1) {
  @return $body-line-height * $amount;
}

55
// ====================
56

57
// theme mixin styles
58
@mixin login_register_h1_style {}
59 60 61 62
@mixin footer_references_style {}

// ====================

63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
// extends - UI - used for page/view-level wrappers (for centering/grids)
%ui-wrapper {
  @include clearfix();
  @include box-sizing(border-box);
  width: 100%;
}

// extends - UI - window
%ui-window {
  @include clearfix();
  border-radius: 3px;
  box-shadow: 0 1px 2px 1px $shadow-l1;
  margin-bottom: $baseline;
  border: 1px solid $light-gray;
  background: $white;
}

// extends - UI archetypes - well
%ui-well {
  box-shadow: inset 0 1px 2px 1px $shadow-l1;
  padding: ($baseline*0.75) $baseline;
}

86
// extends - UI - visual link
87
%ui-fake-link {
88 89 90 91
  cursor: pointer;
}

// extends - UI - functional disable
92
%ui-disabled {
93 94
  pointer-events: none;
  outline: none;
95
  cursor: default;
96 97 98
}

// extends - UI - depth levels
99 100 101 102 103 104
%ui-depth0 { z-index: 0; }
%ui-depth1 { z-index: 10; }
%ui-depth2 { z-index: 100; }
%ui-depth3 { z-index: 1000; }
%ui-depth4 { z-index: 10000; }
%ui-depth5 { z-index: 100000; }
105

106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
// extends - UI - utility - nth-type style clearing
%wipe-first-child {

  &:first-child {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
  }
}

// extends - UI - utility - nth-type style clearing
%wipe-last-child {

  &:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
  }
}

126
// extends -hidden elems - screenreaders
127
%text-sr {
128 129 130 131 132 133 134 135 136
  border: 0;
  clip: rect(1px 1px 1px 1px);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}
137

138 139 140 141 142 143
// extends - ensures proper contrast for automated checkers
%a11y-ensure-contrast {
  background: $white;
  color: $black;
}

144
// extends - UI - removes list styling/spacing when using uls, ols for navigation and less content-centric cases
145
%ui-no-list {
146 147 148 149 150 151 152 153 154 155 156 157
  list-style: none;
  margin: 0;
  padding: 0;
  text-indent: 0;

  li, dt, dd {
    margin: 0;
    padding: 0;
  }
}

// extends - text - image-replacement hidden text
158
%text-hide {
159 160 161 162 163 164
  text-indent: 100%;
  white-space: nowrap;
  overflow: hidden;
}

// extends - text - wrapping
165
%text-wrap {
166 167 168 169 170 171 172
  text-wrap: wrap;
  white-space: pre-wrap;
  white-space: -moz-pre-wrap;
  word-wrap: break-word;
}

// extends - text - text overflow by ellipsis
173
%text-truncated {
174 175 176 177 178
  @include box-sizing(border-box);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
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

// border control
%no-border-top {
  border-top: none;
}

%no-border-bottom {
  border-bottom: none;
}

%no-border-left {
  border-left: none;
}

%no-border-right {
  border-right: none;
}

// outline
%no-outline {
  outline: none;
}

// shame-based mixins to centrally override poor styling
%shame-link-base {
  color: $link-color;

  &:hover, &:focus {
    color: saturate($link-color, 50%);
  }
}

%shame-link-text {
  @extend %shame-link-base;

  &:hover, &:focus {
    text-decoration: underline !important;
  }
}