_controls.scss 8.62 KB
Newer Older
1 2 3
// studio - elements - UI controls
// ====================

4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
// Table of Contents 
// * +General Action - Extend
// * +General Type and Size - Extend
// * +Primary Button - Extends
// * +Secondary Button - Extends
// * +Button
// * +UI Dropdown Button - Extend
// * +UI Nav Dropdown Button - Extend
// * +UI Actions List - Extend
// * +UI Expand/Collapse - Extend
// * +Drag and Drop



// +General Action - Extend
// ==================== 
20 21 22 23 24 25 26 27 28 29
%action {
  @extend %ui-fake-link;

  &.is-disabled {
    @extend %ui-disabled;
    -webkit-filter: grayscale(65%);
    opacity: 0.65;
  }
}

30 31
// +General Type and Size - Extend
// ==================== 
32 33 34 35 36 37
%sizing {
  @extend %t-action4;
  padding: ($baseline/4) ($baseline/2) ($baseline/3) ($baseline/2);
}


38 39
// +Primary Button - Extends
// ==================== 
40
// gray primary button
41 42
%btn-primary-gray {
  @extend %ui-btn-primary;
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
  background: $gray-l1;
  border-color: $gray-l2;
  color: $white;

  &:hover, &:active {
    border-color: $gray-l1;
    background: $gray;
  }

  &.current, &.active {
    background: $gray-d1;
    color: $gray-l1;

    &:hover, &:active {
      background: $gray-d1;
    }
  }
}

// blue primary button
63 64
%btn-primary-blue {
  @extend %ui-btn-primary;
65 66 67 68 69
  background: $blue;
  border-color: $blue-s1;
  color: $white;

  &:hover, &:active {
70 71
    background: $blue-l1;
    border-color: $blue-l1;
72 73 74 75 76 77 78 79 80 81 82 83 84 85
  }

  &.current, &.active {
    background: $blue-d1;
    color: $blue-l4;
    border-color: $blue-d2;

    &:hover, &:active {
      background: $blue-d1;
    }
  }
}

// green primary button
86 87
%btn-primary-green {
  @extend %ui-btn-primary;
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
  background: $green;
  border-color: $green;
  color: $white;

  &:hover, &:active {
    background: $green-s1;
    border-color: $green-s1;
  }

  &.current, &.active {
    background: $green-d1;
    color: $green-l4;
    border-color: $green-d2;

    &:hover, &:active {
      background: $green-d1;
    }
  }
}

108 109
// +Secondary Button - Extends
// ==================== 
110
// gray secondary button
111 112
%btn-secondary-gray {
  @extend %ui-btn-secondary;
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
  border-color: $gray-l3;
  color: $gray-l1;

  &:hover, &:active {
    background: $gray-l3;
    color: $gray-d2;
  }

  &.current, &.active {
    background: $gray-d2;
    color: $gray-l5;

    &:hover, &:active {
      background: $gray-d2;
    }
  }
}

// blue secondary button
132 133
%btn-secondary-blue {
  @extend %ui-btn-secondary;
134 135 136 137
  border-color: $blue-l3;
  color: $blue;

  &:hover, &:active {
138
    background: $blue-l4;
139 140 141 142 143 144 145 146 147 148 149 150 151 152
    color: $blue-s2;
  }

  &.current, &.active {
    border-color: $blue-l3;
    background: $blue-l3;
    color: $blue-d1;

    &:hover, &:active {

    }
  }
}

Mathew Peterson committed
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
// white secondary button
%btn-secondary-white {
  @extend %ui-btn-secondary;
  border-color: $white-t2;
  color: $white-t3;

  &:hover, &:active {
    border-color: $white;
    color: $white;
  }

  &.current, &.active {
    background: $gray-d2;
    color: $gray-l5;

    &:hover, &:active {
      background: $gray-d2;
    }
  }
}

174
// green secondary button
175 176
%btn-secondary-green {
  @extend %ui-btn-secondary;
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
  border-color: $green-l4;
  color: $green-l2;

  &:hover, &:active {
    background: $green-l4;
    color: $green-s1;
  }

  &.current, &.active {
    background: $green-s1;
    color: $green-l4;

    &:hover, &:active {
      background: $green-s1;
    }
  }
}

195 196
// +Button Element
// ==================== 
197
.button {
198

199
  .icon {
200 201 202 203 204
    display: inline-block;
    vertical-align: middle;
    margin-right: ($baseline/4);
  }
}
205

206
// +UI Dropdown Button - Extend
207
// ====================
208 209 210
%ui-btn-dd {
  @extend %ui-btn;
  @extend %ui-btn-pill;
211 212 213 214 215 216 217
  padding:($baseline/4) ($baseline/2);
  border-width: 1px;
  border-style: solid;
  border-color: transparent;
  text-align: center;

  &:hover, &:active {
218
    @extend %ui-fake-link;
219 220 221 222
    border-color: $gray-l3;
  }

  &.current, &.active, &.is-selected {
223
    box-shadow: inset 0 1px 2px 1px $shadow-l1;
224 225 226 227
    border-color: $gray-l3;
  }
}

228 229
// +UI Nav Dropdown Button - Extend
// ====================
230 231
%ui-btn-dd-nav-primary {
  @extend %ui-btn-dd;
232 233
  background: $white;
  border-color: $white;
234
  color: $gray-d1;
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249

  &:hover, &:active {
    background: $white;
    color: $blue-s1;
  }

  &.current, &.active {
    background: $white;
    color: $gray-d4;

    &:hover, &:active {
      color: $blue-s1;
    }
  }
}
250

251
// +UI Actions List - Extend
252
// ====================
253 254 255
%actions-list {
  display: inline-block;
  margin-bottom: 0;
256 257

  .action-item {
258
    position: relative;
259
    display: inline-block;
260
    vertical-align: middle;
261
    margin: ($baseline/10) 0 ($baseline/10) ($baseline/10);
262 263

    .action-button {
264
      @include transition(all $tmg-f3 linear 0s);
265
      display: block;
266
      border-radius: 3px;
267
      padding: 3px ($baseline/2);
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
      color: $gray-l1;

      &:hover {
        background-color: $blue;
        color: $gray-l6;
      }

      .action-button-text {
        padding-left: 1px;
        text-transform: uppercase;
      }

      &.delete-button:hover {
        background-color: $gray-l1;
      }
283

284
      .icon {
285 286
        font-style: normal;
      }
287
    }
288 289 290 291 292 293 294

    .drag-handle {
      display: block;
      float: none;
      height: ($baseline*1.2);
      width: ($baseline);
      margin: 0;
295 296 297

      // CASE: right to left layout
      @include rtl {
298
       background: transparent url("../images/drag-handles.png") no-repeat left center;
299 300 301 302
      }

      // CASE: left to right layout
      @include ltr {
303
        background: transparent url("../images/drag-handles.png") no-repeat right center;
304
      }
305
    }
306 307 308 309

    &.toggle-action {
      // TODO: generalize and move checkbox styling in from static-pages and assets sass
    }
310 311 312
  }
}

313 314 315
// +UI Expand/Collapse - Extend
// ====================
// TODO: this should be transitioned away from in favor of %ui-expand-collapse
316 317 318 319 320 321 322 323 324 325 326 327
%expand-collapse {
  @include transition(all $tmg-f2 linear 0s);
  display: inline-block;
  color: $gray-l2;
  vertical-align: top;

  &:hover {
    color: $blue;
  }

  .ui-toggle-expansion {
    @include transition(all $tmg-f2 ease-in-out 0s);
328
    @extend %t-action1;
329 330 331 332 333 334 335 336 337 338 339 340
    display: inline-block;
    margin-right: ($baseline/4);
    color: $gray-l3;
    vertical-align: middle;
  }

  &.expand .ui-toggle-expansion {
    @include transform(rotate(-90deg));
    @include transform-origin(50% 50%);
  }
}

341 342 343
// +UI Expand/Collapse - Extend
// ====================
// will replace %expand-collapse
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359
%ui-expand-collapse {
  @include transition(all $tmg-f2 linear 0s);


  // CASE: default (is expanded)
  .ui-toggle-expansion {
    @include transition(all $tmg-f2 ease-in-out 0s);
    display: inline-block;
    vertical-align: middle;

    .icon {
      @include transition(all $tmg-f2 ease-in-out 0s);
    }

    // STATE: hover/active
    &:hover, &:active {
360
      @extend %ui-fake-link;
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377
      color: $ui-link-color-focus;
    }
  }

  // CASE: is collapsed
  &.is-collapsed {

    .ui-toggle-expansion {

      .icon {
        @include transform(rotate(-90deg));
        @include transform-origin(50% 50%);
      }
    }
  }
}

378 379 380 381
// +Drag and Drop Styling
// ====================

// UI: drag handle
382 383 384 385 386 387
.drag-handle {

  &:hover, &:focus {
    cursor: move;
  }
}
388 389
 
// UI: is draggable
390
.is-draggable {
391
  @include transition(border-color $tmg-f2 ease-in-out 0, box-shadow $tmg-f2 ease-in-out 0, margin $tmg-f2 ease-in-out 0);
392 393 394 395 396 397 398 399 400 401
  position: relative;

  .draggable-drop-indicator {
    @extend %ui-depth3;
    @include transition(opacity $tmg-f2 linear 0s);
    @include size(100%, auto);
    position: absolute;
    border-top: 1px solid $blue-l1;
    opacity: 0.0;

402
    .fa-caret-right {
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419
      @extend %t-icon5;
      position: absolute;
      top: -12px;
      left: -($baseline/4);
      color: $blue-s1;
    }
  }

  .draggable-drop-indicator-before {
    top: -($baseline/2);
  }

  .draggable-drop-indicator-after {
    bottom: -($baseline/2);
  }
}

420
// UI: is dragging - drag state
421 422 423 424 425 426 427 428 429 430
.is-dragging {
  @extend %ui-depth4;
  left: -($baseline/4);
  box-shadow: 0 1px 2px 0 $shadow-d1;
  cursor: move;
  opacity: 0.65;
  border: 1px solid $gray-d3;

  // UI: condition - valid drop
  &.valid-drop {
431 432
    border-color: $ui-action-primary-color-focus;
    box-shadow: 0 1px 2px 0 rgba($ui-action-primary-color-focus, 0.50);
433 434 435 436 437 438 439 440 441 442 443 444
  }
}

// UI: drag state - was dragging
.was-dragging {
  @include transition(transform $tmg-f2 ease-in-out 0);
}

// UI: drag target
.drop-target {

  &.drop-target-before {
445
    margin-top: ($baseline*1.5);
446 447 448 449 450 451 452

    > .draggable-drop-indicator-before {
      opacity: 1.0;
    }
  }

  &.drop-target-after {
453
    margin-bottom: ($baseline*1.5);
454 455 456 457 458 459

    > .draggable-drop-indicator-after {
      opacity: 1.0;
    }
  }
}
460 461 462 463 464 465 466

// UI: drop state - was dropped
.was-dropped {
  @include animation(was-dropped $tmg-avg ease-in-out 1);
  border-color: $ui-action-primary-color-focus;
  box-shadow: 0 1px 2px 0 rgba($ui-action-primary-color-focus, 0.50);
}