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

4
// Table of Contents
5 6 7 8 9 10 11 12 13 14 15 16 17 18
// * +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
19
// ====================
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
// +General Type and Size - Extend
31
// ====================
32 33 34 35 36 37
%sizing {
  @extend %t-action4;
  padding: ($baseline/4) ($baseline/2) ($baseline/3) ($baseline/2);
}


38
// +Primary Button - Extends
39
// ====================
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
  background: $uxpl-blue-base;
  border-color: $uxpl-blue-base;
67 68 69
  color: $white;

  &:hover, &:active {
70 71
    background: $uxpl-blue-hover-active;
    border-color: $uxpl-blue-hover-active;
72 73 74
  }

  &.current, &.active {
75 76
    background: $uxpl-blue-hover-active;
    border-color: $uxpl-blue-hover-active;
77 78 79
    color: $blue-l4;

    &:hover, &:active {
80
      background: $uxpl-blue-hover-active;
81 82 83 84 85
    }
  }
}

// green primary button
86 87
%btn-primary-green {
  @extend %ui-btn-primary;
88 89
  background: $uxpl-green-base;
  border-color: $uxpl-green-base;
90 91 92
  color: $white;

  &:hover, &:active {
93 94
    background: $uxpl-green-dark-hover-active;
    border-color: $uxpl-green-dark-hover-active;
95 96 97
  }

  &.current, &.active {
98
    background: $uxpl-green-dark-hover-active;
99
    color: $white;
100
    border-color: $uxpl-green-dark-hover-active;
101 102

    &:hover, &:active {
103
      background: $uxpl-green-dark-hover-active;
104 105 106 107
    }
  }
}

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

  &: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
  border-color: $blue-l3;
135
  color: $uxpl-blue-base;
136 137

  &:hover, &:active {
138
    background: $blue-l4;
139
    color: $uxpl-blue-hover-active;
140 141 142 143 144
  }

  &.current, &.active {
    border-color: $blue-l3;
    background: $blue-l3;
145
    color: $uxpl-blue-base;
146 147 148
  }
}

Mathew Peterson committed
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
// 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;
    }
  }
}

170
// green secondary button
171 172
%btn-secondary-green {
  @extend %ui-btn-secondary;
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
  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;
    }
  }
}

191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
// LMS-style CAPA button for consistency with LMS buttons
%btn-lms-style {
    border: 1px solid $btn-lms-border;
    border-radius: 3px;
    box-shadow: inset 0 1px 0 0 $white;
    color: $gray-d3;
    display: inline-block;
    font-size: inherit;
    font-weight: bold;
    background-color: $btn-lms-background;
    background-image: -webkit-linear-gradient($btn-lms-background,$btn-lms-gradient);
    background-image: linear-gradient($btn-lms-background,$btn-lms-gradient);
    padding: 7px 18px;
    text-decoration: none;
    text-shadow: 0 1px 0 $btn-lms-shadow;
    background-clip: padding-box;
    font-size: 0.8125em;
muhammad-ammar committed
208

209 210 211 212 213 214 215 216
    &:focus,
    &:hover {
        box-shadow: inset 0 1px 0 0 $btn-lms-shadow-hover;
        cursor: pointer;
        background-color: $btn-lms-background-hover;
        background-image: -webkit-linear-gradient($btn-lms-background-hover,$btn-lms-gradient-hover);
        background-image: linear-gradient($btn-lms-background-hover,$btn-lms-gradient-hover);
    }
muhammad-ammar committed
217

218 219 220 221 222 223
    &:active {
        border: 1px solid $btn-lms-border;
        box-shadow: inset 0 0 8px 4px $btn-lms-shadow-active,inset 0 0 8px 4px $btn-lms-shadow-active;
    }
}

224
// +Button Element
225
// ====================
226
.button {
227

228
  .icon {
229
    @include margin-right($baseline/4);
230 231 232 233
    display: inline-block;
    vertical-align: middle;
  }
}
234

235
// +UI Dropdown Button - Extend
236
// ====================
237 238 239
%ui-btn-dd {
  @extend %ui-btn;
  @extend %ui-btn-pill;
240 241 242 243 244 245 246
  padding:($baseline/4) ($baseline/2);
  border-width: 1px;
  border-style: solid;
  border-color: transparent;
  text-align: center;

  &:hover, &:active {
247
    @extend %ui-fake-link;
248 249 250 251
    border-color: $gray-l3;
  }

  &.current, &.active, &.is-selected {
252
    box-shadow: inset 0 1px 2px 1px $shadow-l1;
253 254 255 256
    border-color: $gray-l3;
  }
}

257 258
// +UI Nav Dropdown Button - Extend
// ====================
259 260
%ui-btn-dd-nav-primary {
  @extend %ui-btn-dd;
261 262
  background: $white;
  border-color: $white;
263
  color: $gray-d1;
264 265 266

  &:hover, &:active {
    background: $white;
267
    color: $uxpl-blue-hover-active;
268 269 270 271 272 273 274
  }

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

    &:hover, &:active {
275
      color: $uxpl-blue-hover-active;
276 277 278
    }
  }
}
279

280
// +UI Actions List - Extend
281
// ====================
282 283 284
%actions-list {
  display: inline-block;
  margin-bottom: 0;
285 286

  .action-item {
287
    position: relative;
288
    display: inline-block;
289
    vertical-align: middle;
290
    margin: ($baseline/10) 0 ($baseline/10) ($baseline/10);
291 292

    .action-button {
293
      @include transition(all $tmg-f3 linear 0s);
294
      display: block;
295
      border-radius: 3px;
296
      padding: 3px ($baseline/2);
297
      color: $gray-d1;
298 299

      &:hover {
300
        background-color: $uxpl-blue-base;
301 302 303 304 305 306 307 308 309 310 311
        color: $gray-l6;
      }

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

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

313
      .icon {
314 315
        font-style: normal;
      }
316
    }
317 318 319 320 321 322 323

    .drag-handle {
      display: block;
      float: none;
      height: ($baseline*1.2);
      width: ($baseline);
      margin: 0;
324 325 326

      // CASE: right to left layout
      @include rtl {
327
       background: transparent url("#{$static-path}/images/drag-handles.png") no-repeat left center;
328 329 330 331
      }

      // CASE: left to right layout
      @include ltr {
332
        background: transparent url("#{$static-path}/images/drag-handles.png") no-repeat right center;
333
      }
334
    }
335 336 337 338

    &.toggle-action {
      // TODO: generalize and move checkbox styling in from static-pages and assets sass
    }
muhammad-ammar committed
339 340 341 342 343 344 345 346

    .btn-default.delete-button {
      border: none;
    }

    .btn-default.edit-button {
      font-weight: 300;
    }
347 348 349 350 351 352 353 354 355 356 357 358 359 360

    .stack-move-icon {
      font-size: 0.52em;

      @include rtl {
        .fa-file-o {
          @include transform(rotateY(180deg));
        }

        .fa-arrow-right {
          @include transform(rotate(180deg));
        }
      }
    }
361 362 363
  }
}

364 365 366
// +UI Expand/Collapse - Extend
// ====================
// TODO: this should be transitioned away from in favor of %ui-expand-collapse
367 368 369 370 371 372 373
%expand-collapse {
  @include transition(all $tmg-f2 linear 0s);
  display: inline-block;
  color: $gray-l2;
  vertical-align: top;

  &:hover {
374
    color: $uxpl-blue-base;
375 376 377 378
  }

  .ui-toggle-expansion {
    @include transition(all $tmg-f2 ease-in-out 0s);
379
    @include margin-right($baseline/4);
380
    @extend %t-action1;
381 382 383 384 385 386 387 388 389 390 391
    display: inline-block;
    color: $gray-l3;
    vertical-align: middle;
  }

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

392 393 394
// +UI Expand/Collapse - Extend
// ====================
// will replace %expand-collapse
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410
%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 {
411
      @extend %ui-fake-link;
412
      color: $uxpl-blue-base;
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428
    }
  }

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

    .ui-toggle-expansion {

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

429 430 431 432
// +Drag and Drop Styling
// ====================

// UI: drag handle
433 434 435 436 437 438
.drag-handle {

  &:hover, &:focus {
    cursor: move;
  }
}
439

440
// UI: is draggable
441
.is-draggable {
442
  @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);
443 444 445 446 447 448 449 450 451 452
  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;

453
    .fa-caret-right {
454 455 456 457
      @extend %t-icon5;
      position: absolute;
      top: -12px;
      left: -($baseline/4);
458
      color: $blue-d1;
459 460 461 462 463 464 465 466 467 468 469 470
    }
  }

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

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

471
// UI: is dragging - drag state
472 473 474 475 476 477 478 479 480 481
.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 {
482 483
    border-color: $ui-action-primary-color-focus;
    box-shadow: 0 1px 2px 0 rgba($ui-action-primary-color-focus, 0.50);
484 485 486 487 488 489 490 491 492 493 494 495
  }
}

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

// UI: drag target
.drop-target {

  &.drop-target-before {
496
    margin-top: ($baseline*1.5);
497 498 499 500 501 502 503

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

  &.drop-target-after {
504
    margin-bottom: ($baseline*1.5);
505 506 507 508 509 510

    > .draggable-drop-indicator-after {
      opacity: 1.0;
    }
  }
}
511 512 513 514 515 516 517

// 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);
}