_forms.scss 8.62 KB
Newer Older
1 2 3
// studio - elements - forms
// ====================

4
// Table of Contents
5 6 7 8 9 10 11 12 13 14
// * +Forms - General
// * +Field - Is Editable
// * +Field - With Error
// * +Forms - Additional UI
// * +Form - Create New
// * +Form - Inline Name Edit
// * +Form - Create New Wrapper
// * +Form - Grandfathered

// +Forms - General
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
// ====================
// element-specific utilities
// --------------------
// UI: checkbox/radio inputs
%input-tickable {

  ~ label {
    color: $color-copy-base;
  }

  // STATE: checked/selected
  &:checked ~ label {
    @extend %t-strong;
    color: $ui-action-primary-color-focus;
  }
}

32 33 34 35 36
input[type="text"],
input[type="email"],
input[type="password"],
textarea.text {
  @include box-sizing(border-box);
37
  @include linear-gradient($gray-l5, $white);
38
  @extend %t-copy-sub2;
39
  @extend %t-demi-strong;
40
  padding: 6px 8px 8px;
41
  border: 1px solid $gray-l2;
42
  border-radius: 2px;
43
  background-color: $gray-l5;
44
  box-shadow: inset 0 1px 2px $shadow-l1;
45
  font-family: 'Open Sans', sans-serif;
46
  color: $color-copy-emphasized;
47 48 49 50 51
  outline: 0;

  &::-webkit-input-placeholder,
  &:-moz-placeholder,
  &:-ms-input-placeholder {
52
      color: $gray-l2;
53 54 55 56 57 58 59 60
  }

  &:focus {
    @include linear-gradient($paleYellow, tint($paleYellow, 90%));
    outline: 0;
  }
}

61
// +Fields - Not Editable
62
// ====================
63 64 65 66 67 68
.field.is-not-editable {

  & label.is-focused {
   color: $gray-d2;
  }

69
  label, input, textarea {
70 71 72 73
    pointer-events: none;
  }
}

74
// +Fields - With Error
75
// ====================
76 77 78 79 80 81 82
.field.error {

  input, textarea {
    border-color: $red;
  }
}

83
// +Forms - Additional UI
84
// ====================
85 86
form {

87 88 89 90 91 92 93 94 95
  // CASE: cosmetic checkbox input
  .checkbox-cosmetic {

    .input-checkbox-checked, .input-checkbox-unchecked, .label {
      display: inline-block;
      vertical-align: middle;
    }

    .input-checkbox-checked, .input-checkbox-unchecked {
96
      width: ($baseline*0.75);
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
    }

    .input-checkbox {
      @extend %cont-text-sr;

      // CASE: unchecked
      ~ label .input-checkbox-checked {
        display: none;
      }

      ~ label .input-checkbox-unchecked {
        display: inline-block;
      }

      // CASE: checked
      &:checked {

        ~ label .input-checkbox-checked {
          display: inline-block;
        }

        ~ label .input-checkbox-unchecked {
          display: none;
        }
      }

    }
  }

126 127 128 129 130 131 132 133 134 135
  // CASE: checkbox input
  .field-checkbox .input-checkbox {
    @extend %input-tickable;
  }

  // CASE: radio input
  .field-radio .input-radio {
    @extend %input-tickable;
  }

136
  // CASE: file input
137
  input[type="file"] {
138
    @extend %t-copy-sub1;
139 140
  }

141 142
  .note {
    @include box-sizing(border-box);
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

    .title {

    }

    .copy {

    }

    // note with actions
    &.has-actions {
      @include clearfix();

      .title {

      }

      .copy {

      }

      .list-actions {

      }
    }
168 169 170 171 172 173 174
  }

  .note-promotion {

  }
}

175
// +Form - Create New
176
// ====================
177
// form styling for creating a new content item (course, user, textbook)
Mathew Peterson committed
178 179
// TODO: refactor this into a placeholder to extend.
.form-create {
180
  @extend %ui-window;
181 182

  .title {
183
    @extend %t-title4;
184
    @extend %t-strong;
185
    padding: $baseline ($baseline*1.5) 0 ($baseline*1.5);
186 187 188
  }

  fieldset {
189
    padding: $baseline ($baseline*1.5);
190 191
  }

192 193

  .list-input {
194
    @extend %cont-no-list;
195 196 197 198 199 200 201 202 203 204 205

    .field {
      margin: 0 0 ($baseline*0.75) 0;

      &:last-child {
        margin-bottom: 0;
      }

      &.required {

        label {
206
          @extend %t-strong;
207 208 209 210 211 212 213 214 215 216 217 218 219
        }

        label:after {
          margin-left: ($baseline/4);
          content: "*";
        }
      }

      label, input, textarea {
        display: block;
      }

      label {
220
        @extend %t-copy-sub1;
221
        @include transition(color $tmg-f3 ease-in-out 0s);
222 223 224 225 226 227 228
        margin: 0 0 ($baseline/4) 0;

        &.is-focused {
          color: $blue;
        }
      }

229

230
      input, textarea {
231
        @extend %t-copy-base;
232
        @include transition(all $tmg-f2 ease-in-out 0s);
233 234 235 236 237 238 239 240 241 242 243 244
        height: 100%;
        width: 100%;
        padding: ($baseline/2);

        &.long {
          width: 100%;
        }

        &.short {
          width: 25%;
        }

245 246 247 248
        /*@include placeholder {
          color: $gray-l3;
        }*/

249
        &:focus {
250

251
          + .tip {
252
            color: $gray-d1;
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
          }
        }
      }

      textarea.long {
        height: ($baseline*5);
      }

      input[type="checkbox"] {
        display: inline-block;
        margin-right: ($baseline/4);
        width: auto;
        height: auto;

        & + label {
          display: inline-block;
        }
      }

      .tip {
273
        @extend %t-copy-sub2;
Mathew Peterson committed
274 275 276
        @include transition(color 0.15s ease-in-out);


277 278 279 280 281
        display: block;
        margin-top: ($baseline/4);
        color: $gray-l3;
      }

Mathew Peterson committed
282 283 284 285 286
      .tip-note {
        display: block;
        margin-top: ($baseline/4);
      }

287 288 289 290
      .tip-error {
        display: none;
        float: none;
      }
291

292
      &.error {
293 294 295 296
        label {
          color: $red;
        }

297
        .is-showing {
298
            @extend %anim-fadeIn;
299 300 301
        }

        .is-hiding {
302
            @extend %anim-fadeOut;
303 304
        }

305 306 307 308 309
        .tip-error {
          display: block;
          color: $red;
        }

310 311 312 313 314
        input {
          border-color: $red;
        }
      }
    }
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363

    .field-inline {

      input, textarea, select {
        width: 62%;
        display: inline-block;
      }

      .tip-stacked {
        display: inline-block;
        float: right;
        width: 35%;
        margin-top: 0;
      }

      &.error {
        .tip-error {
        }
      }

    }

    .field-group {
      @include clearfix();
      margin: 0 0 ($baseline/2) 0;

      .field {
        display: block;
        width: 47%;
        border-bottom: none;
        margin: 0 ($baseline*0.75) 0 0;
        padding: ($baseline/4) 0 0 0;
        float: left;
        position: relative;

        &:nth-child(odd) {
          float: left;
        }

        &:nth-child(even) {
          float: right;
          margin-right: 0;
        }

        input, textarea {
          width: 100%;
        }
      }
    }
364 365 366 367
  }

  .actions {
    box-shadow: inset 0 1px 2px $shadow;
368 369 370
    margin-top: ($baseline*0.75);
    border-top: 1px solid $gray-l1;
    padding: ($baseline*0.75) ($baseline*1.5);
371 372
    background: $gray-l6;

373 374
    .action {
      @include transition(all $tmg-f2 linear 0s);
375
      @extend %t-strong;
376 377
      display: inline-block;
      padding: ($baseline/5) $baseline;
378
      text-transform: uppercase;
379 380
    }

381 382
    .action-primary {
      @include blue-button;
383
      @extend %t-action2;
384 385
    }

386 387
    .action-secondary {
      @include grey-button;
388
      @extend %t-action2;
389 390 391 392
    }
  }
}

393 394
// +Form - Inline Name Edit
// ====================
395
// form - inline xblock name edit on unit, container, outline
396
// TODO: abstract this out into a Sass placeholder
397 398 399 400
.incontext-editor.is-editable {

  .incontext-editor-value,
  .incontext-editor-action-wrapper {
401
    @extend %cont-truncated;
402
    display: inline-block;
403 404
    vertical-align: middle;
    max-width: 80%;
405 406 407 408 409 410
  }

  .incontext-editor-open-action {
    @extend %ui-btn-non-blue;
    @extend %t-copy-base;
    padding-top: ($baseline/10);
411 412 413 414

    .icon.icon {
      vertical-align: baseline;
    }
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433
  }

  .incontext-editor-form {
    display: none;
  }

  &.is-editing {

    .incontext-editor-value,
    .incontext-editor-action-wrapper {
      display: none;
    }

    .incontext-editor-form {
      display: inline-block;
    }
  }
}

434 435
// +Form - Create New Wrapper
// ====================
Mathew Peterson committed
436
.wrapper-create-element {
437 438 439
  height: auto;
  opacity: 1.0;
  pointer-events: auto;
Mathew Peterson committed
440
  overflow: hidden;
441
  display: none;
Mathew Peterson committed
442 443 444 445 446 447

  &.animate {
    @include transition(opacity $tmg-f1 ease-in-out 0s, height $tmg-f1 ease-in-out 0s);
  }

  &.is-shown {
448
    display: block;
Mathew Peterson committed
449 450 451
  }
}

452 453
// +Form - Grandfathered
// ====================
454 455 456 457 458
input.search {
  padding: 6px 15px 8px 30px;
  @include box-sizing(border-box);
  border: 1px solid $darkGrey;
  border-radius: 20px;
459
  background: url('#{$static-path}/images/search-icon.png') no-repeat 8px 7px #edf1f5;
460 461 462 463 464 465 466 467 468 469
  font-family: 'Open Sans', sans-serif;
  color: $baseFontColor;
  outline: 0;

  &::-webkit-input-placeholder {
      color: #979faf;
  }
}

label {
470
  @extend %t-copy-sub2;
471 472 473 474 475 476 477 478 479 480
}

code {
  padding: 0 4px;
  border-radius: 3px;
  background: #eee;
  font-family: Monaco, monospace;
}

.CodeMirror {
481
  @extend %t-copy-sub1;
482
  background: $white;
483
  font-family: $f-monospace;
484 485 486 487 488 489 490 491 492 493
}

.text-editor {
  width: 100%;
  min-height: 80px;
  padding: 10px;
  @include box-sizing(border-box);
  border: 1px solid $mediumGrey;
  @include linear-gradient(top, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.3));
  background-color:  #edf1f5;
494
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) inset;
495
  font-family: Monaco, monospace;
496
}