_xblocks.scss 19.6 KB
Newer Older
1 2 3
// studio - elements - xblock rendering
// ==========================

4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
// Table of Contents
// * +Layout - Xblocks
// * +Licensing - Xblocks
// * +Pagination - Xblocks 
// * +Messaging - Xblocks
// * +Case: Page Level
// * +Case: Nesting Level
// * +Case: Element / Component Level
// * +Case: Experiment Groups - Edited
// * +Editing - Xblocks
// * +Case - Special Xblock Type Overrides


// +Layout - Xblocks 
// ====================
19 20
// styling for xblocks at various levels of nesting: page level,
.wrapper-xblock {
21
  margin: ($baseline/2);
22 23 24 25 26
  border: 1px solid $gray-l4;
  border-radius: ($baseline/5);
  background: $white;
  box-shadow: 0px 1px 1px $shadow-l1;

27 28
  // STATE: hover/focus
  &:hover, &:focus {
29 30 31
    box-shadow: 0 0 1px $shadow;
  }

32
  // UI: xblock header primary for main title and xblock actions
33
  .xblock-header-primary {
34 35 36 37 38
    @include box-sizing(border-box);
    border-bottom: 1px solid $gray-l4;
    border-radius: ($baseline/5) ($baseline/5) 0 0;
    min-height: ($baseline*2.5);
    background-color: $gray-l6;
39
    padding: ($baseline/2) ($baseline/2) ($baseline/2) ($baseline);
40 41 42

    .header-details {
      @extend %cont-truncated;
43 44
      display: inline-block;
      width: 50%;
45
      vertical-align: middle;
46 47 48 49 50

      .xblock-display-name {
        display: inline-block;
        vertical-align: middle;
      }
51 52 53
    }

    .header-actions {
54 55
      display: inline-block;
      width: 49%;
56
      vertical-align: middle;
57
      @include text-align(right);
58 59 60
    }
  }

61
  // UI: secondary header for meta-information and associated actions
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
  .xblock-header-secondary {
    overflow: hidden;
    border-top: 1px solid $gray-l3;
    background-color: $gray-l5;
    padding: ($baseline/2) $baseline;

    .meta-info {
      display: inline-block;
      vertical-align: middle;
      width: 65%;
      font-style: italic;
      color: $gray;
    }

    .actions-list {
      width: 34%;
      display: inline-block;
      vertical-align: middle;
      text-align: right;

      .action-item {
        display: inline-block;

        .action-button {
          @include transition(all $tmg-f3 linear 0s);
          display: block;
          width: auto;
          height: ($baseline*1.5);
          border-radius: 3px;
          padding: 3px ($baseline/2) 0 ($baseline/2);
          color: $gray-l1;

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

          .action-button-text {
            display: inline-block;
            vertical-align: middle;
            padding: 0 1px;
            text-transform: uppercase;
          }

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

111
        .icon {
112 113 114 115
          display: inline-block;
          vertical-align: middle;
        }
      }
116 117
    }
  }
118

119 120
  // +Licensing - Xblocks 
  // ====================
121
  .xblock-license,
122 123 124 125 126 127
  .xmodule_display.xmodule_HtmlModule .xblock-license,
  .xmodule_VideoModule .xblock-license {
    @include text-align(right);
    @extend %t-title7;
    display: block;
    width: auto;
128
    border-top: 1px solid $gray-l3;
129 130 131 132 133 134 135 136 137 138 139
    padding: ($baseline/4) 0;
    color: $gray;
    text-align: $bi-app-right;

    .license-label,
    .license-value,
    .license-actions {
      display: inline-block;
      vertical-align: middle;
      margin-bottom: 0;
    }
140 141

    a {
142
      color: $gray;
143 144 145 146 147

      &:hover {
        color: $ui-link-color;
      }
    }
148 149 150

    i {
      font-style: normal;
151
    }
152
  }
153

154 155 156
  // CASE: xblocks video
  .xmodule_VideoModule .xblock-license {
    border: 0;
157 158
  }

159 160

  // +Pagination - Xblocks 
161 162
  .container-paging-header {
    .meta-wrap {
163
      margin: $baseline ($baseline/2);
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
    }
    .meta {
      @extend %t-copy-sub2;
      display: inline-block;
      vertical-align: top;
      width: flex-grid(9, 12);
      color: $gray-l1;

      .count-current-shown,
      .count-total,
      .sort-order {
        @extend %t-strong;
      }
    }

    .pagination {
      @extend %pagination;
    }
  }

  .container-paging-footer {
    .pagination {
      @extend %pagination;
    }
  }

190
  //UI: default internal xblock content styles
191 192
  // ====================
  // TO-DO: clean-up / remove this reset
193 194 195 196 197 198 199 200 201 202 203 204
  // internal headings for problems and video components
  h2 {
    @extend %t-title5;
    margin: ($baseline*1.5) ($baseline*2) ($baseline*1.5) 0;
    color: $gray;
    letter-spacing: 1px;
    text-transform: uppercase;
  }


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

205
  .wrapper-xblock {
206

207 208
    // UI: xblocks - calls-to-action
    .header-actions .actions-list {
209 210 211
      @extend %actions-list;
    }

212 213 214
    // CASE: xblock is collapsible
    &.is-collapsible,
    &.xblock-type-container {
215

216 217 218
      .icon {
        font-style: normal;
      }
219

220 221 222 223 224
      .expand-collapse {
        @extend %expand-collapse;
        margin: 0 ($baseline/4);
        height: ($baseline*1.25);
        width: $baseline;
225

226 227 228
        &:focus {
          outline: 0;
        }
229 230
      }

231
      .action-view {
232

233 234 235 236 237 238 239 240
        .action-button {
          transition: none;
        }

        .action-button-text {
          padding-right: ($baseline/5);
          padding-left: 0;
        }
241
      }
242 243
    }

244 245
    // CASE: xblock has specific visibility based on content groups set
    &.has-group-visibility-set {
246

247 248
      .action-visibility .visibility-button.visibility-button { // needed to cascade in front of overscoped header-actions CSS rule
        color: $color-visibility-set;
249 250 251 252
      }
    }
  }

253 254
  // +Messaging - Xblocks
  // ====================
255 256 257 258 259 260
  // xblock message area, for general information as well as validation
  .wrapper-xblock-message {

    .xblock-message {
      @extend %t-copy-sub1;
      background-color: $gray-d2;
261
      padding: ($baseline*0.75);
262 263
      color: $white;

264
      .icon {
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
        font-style: normal;
      }

      &.information {
        @extend %t-copy-sub1;
        background-color: $gray-l5;
        color: $gray-d2;
      }

      &.validation {
        background-color: $gray-d2;
        color: $white;

        a {
          color: $blue-l2;
        }

        &.has-warnings {
283
          border-top: 3px solid $orange;
284

285
          .fa-exclamation-triangle {
286 287 288 289 290 291
            margin-right: ($baseline/2);
            color: $orange;
          }
        }

        &.has-errors {
292
          border-top: 3px solid $red-l2;
293

294
          .fa-exclamation-circle {
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315
            margin-right: ($baseline/2);
            color: $red-l2;
          }
        }
      }
    }

    .xblock-message-list {
      margin-bottom: 0;
    }

    .xblock-message-actions {
      padding: ($baseline/2) $baseline;
      background-color: $gray-d1;

      .actions-list {
        @extend %actions-list;
      }
    }
  }

316 317
  // +Case: Page Level
  // ====================
318 319 320 321 322 323 324 325 326 327 328 329
  &.level-page {
    margin: 0;
    box-shadow: none;
    border: 0;

    .xblock-header {
      display: none;
    }

    .xblock-message {

      &.validation {
330
        padding-top: ($baseline*0.75);
331 332 333
      }

      .xblock-message-list {
334
        margin: 0 ($baseline*2.25);
335 336 337 338 339 340 341 342 343
        list-style-type: disc;
        color: $gray-l3;
      }

      .xblock-message-item {
        padding-bottom: ($baseline/4);
      }

      &.information {
344
        padding: ($baseline/2) 0;
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
        background-color: $gray-l5;
        color: $gray-d1;
      }
    }

    .no-container-content {

      .xblock-message-list {
        margin: 0;
        list-style-type: none;
        color: $gray-d2;
      }
    }

  }

361 362 363
  // +Case: Nesting Level
  // ====================
  // element wrapper level
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396
  &.level-nesting {
    @include transition(all $tmg-f2 linear 0s);
    border: 1px solid $gray-l3;
    padding-bottom: $baseline;

    // min-height to allow drop when empty
    .reorderable-container {
      min-height: $baseline;
    }

    .xblock-header {
      display: block;
    }

    .xblock-header-primary {
      @include ui-flexbox();
      margin-bottom: 0;
      border-bottom: none;
      background: none;
    }

    .xblock-render {
      margin: ($baseline/2);
    }

    // STATE: nesting level xblock is collapsed
    &.collapsed {
      padding-bottom: 0;
      background-color: $gray-l7;
      box-shadow: 0 0 1px $shadow-d2 inset;
    }
  }

397 398
  // +Case: Element / Component Level
  // ====================
399 400 401 402 403 404 405 406 407 408 409 410 411
  &.level-element {
    @include transition(all $tmg-f2 linear 0s);
    box-shadow: none;

    &:hover {
      border-color: $blue;
    }

    .xblock-header {
      display: block;
    }

    .xblock-header-primary {
412
      @extend %t-light;
413 414 415 416
      display: flex;
      margin-bottom: 0;
      border-bottom: 1px solid $gray-l4;
      background-color: $gray-l6;
417 418 419 420
      &.is-collapsed {
        border-bottom: 0;
        border-radius: 3px;
      }
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447
    }

    .xblock-render {
      margin: ($baseline/2);
      padding: ($baseline/2);
    }

    // STATE: container/component with children - abbreviated preview
    &.xblock-type-container {

      .xblock-header-primary {
        margin-bottom: 0;
        border-bottom: 0;
        border-radius: ($baseline/5);
      }

      .xblock-render {
        display: none;
      }
    }

    .wrapper-xblock-message {

      .xblock-message {

        &.information {
          @extend %t-copy-sub2;
448
          padding: 0 $baseline ($baseline*0.75) $baseline;
449 450 451 452 453 454
          color: $gray-l1;
        }
      }
    }
  }

455 456 457
  // +Case: Experiment Groups - Edited
  // ====================
  // edited experiment groups: active and inactive
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476
  .wrapper-groups {

    .title {
      @extend %t-title7;
      margin-left: ($baseline/2);
      color: $gray-l1;
    }

    &.is-active {

      // don't show delete buttons on active groups
      .wrapper-xblock.level-nesting > .xblock-header .action-delete {
        display: none;
      }
    }

    &.is-inactive {
      margin: ($baseline*1.5) 0 0 0;
      border-top: 2px dotted $gray-l2;
477
      padding: ($baseline*0.75) 0;
478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494
      background-color: $gray-l4;

      .wrapper-xblock.level-nesting {
        @include transition(all $tmg-f2 linear 0s);
        opacity: .7;

        &:hover {
          opacity: 1;
        }
      }

      // don't show add new content to inactive groups
      .new-component-item {
        display: none;
      }
    }
  }
495 496
}

497
// +Editing - Xblocks
498 499
// ====================

500 501 502
// xblock Editor tab wrapper
.wrapper-comp-editor {
  display: block;
503

504 505 506 507
  // Because the editor may be a CodeMirror editor (which must be visible at the time it is created
  // in order for it to properly initialize), we must toggle "is-inactive" instead of the more common "is-active"
  &.is-inactive {
    display: none;
508
  }
509 510
}

511 512 513
// xblock Settings tab wrapper
.wrapper-comp-settings {
  display: none;
514

515 516
  &.is-active {
    display: block;
517 518
  }

519 520 521 522
  .file-uploader {
    .upload-setting {
      @extend %ui-btn-flat-outline;
      @extend %t-action3;
523
      @extend %t-strong;
524 525 526 527 528 529 530 531 532 533
      @include box-sizing(border-box);
      display: inline-block;
      padding: ($baseline/2);
      width: 49%;
      margin-right: 2%;
    }

    .download-setting {
      @extend %ui-btn-non;
      @extend %t-action4;
534
      @extend %t-strong;
535 536 537 538 539 540
      @include box-sizing(border-box);
      display: inline-block;
      padding: ($baseline/2);
      width: 49%;
      text-align: center;
      color: $blue;
541

542 543 544 545 546 547 548 549 550
      &:hover {
        background-color: $blue;
      }
    }

    .wrapper-uploader-actions {
      width: 45%;
      display: inline-block;
      min-width: ($baseline*5);
551
    }
552 553
  }

554 555
  //settings-list
  .list-input.settings-list {
556
    @extend %cont-no-list;
557 558 559 560 561 562 563 564 565
    overflow: auto;
    max-height: 400px;

    //chrome scrollbar visibility correction
    &::-webkit-scrollbar {
      -webkit-appearance: none;
      width: 11px;
      height: 11px;
    }
566

567 568 569 570
    &::-webkit-scrollbar-thumb {
      border-radius: 8px;
      border: 2px solid $gray-l2;
      background-color: rgba(0, 0, 0, .5);
571 572
    }

573 574 575 576 577 578 579 580 581 582 583 584
    //component-setting-entry
    .field.comp-setting-entry {
      opacity: 0.7;
      margin: 0 $baseline;
      border-top: 1px solid $gray-l4;
      background-color: $white;
      padding: $baseline ($baseline/2);

      &:first-child {
        border-top: 0;
      }

585 586


587 588 589 590 591 592 593 594 595 596 597 598
      // STATE: hover & focus
      &:hover, &:focus {
        opacity: 1.0;
      }

      &.is-set {
        opacity: 1.0;
        background-color: $white;

        .setting-input {
          color: $blue-l1;
        }
599 600
      }
    }
601

602 603 604 605 606 607
    .wrapper-comp-setting {
      min-width: 300px;
      top: 0;
      vertical-align: top;
      margin-bottom:5px;
      position: relative;
608 609
    }

610 611
    .setting-label {
      @include transition(color $tmg-f2 ease-in-out 0s);
612 613
      @extend %t-copy-sub1;
      @extend %t-strong;
614 615 616 617 618 619 620 621 622 623 624
      vertical-align: middle;
      display: inline-block;
      position: relative;
      left: 0;
      width: 25%;
      min-width: 100px;
      margin-right: ($baseline/2);

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

627 628 629
    input, select, input[type="number"] {
      @include placeholder($gray-l4);
      @include size(100%,100%);
630
      @extend %t-copy-base;
631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651
      width: 45%;
      min-width: 100px;
      padding: ($baseline/2);
      border-radius: 3px;
      border: 1px solid $gray-l2;
      text-overflow: ellipsis;
    }

    //Allows users to copy full value of disabled inputs.
    input.is-disabled {
      text-overflow: clip;
      opacity: .5;
    }

    input[type="number"] {
      width: 42%;
      box-shadow: 0 1px 2px $shadow-l1 inset;
      //For webkit browsers which render number fields differently, make input wider.
      -moz-column-width: {
        width: 32%;
      }
652

653 654 655 656 657 658 659 660 661 662 663
      &:active {
        background-color: #FFFCF1;
      }
    }

    select {

      &:focus {
        box-shadow: 0 0 1px $shadow;
        @include transition(opacity $tmg-f2 ease-in-out 0s);
        background-color: $yellow;
664 665
      }

666 667 668 669
      &:active {
        background-color: $yellow;
      }
    }
670

671
    .action.setting-clear {
672
      @extend %t-action4;
673 674 675 676
      color: $gray;
      width: 25px;
      height: 25px;
      vertical-align: middle;
677
      padding: ($baseline/4);
678
      border-radius: 50%;
679
      margin: 0 ($baseline/2);
680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698
      box-shadow: none;
      text-shadow: none;
      border: 1px solid $gray-l1;
      background-color: $gray-l4;

      &:hover {
        box-shadow: 0 1px 1px $shadow;
        @include transition(opacity $tmg-f2 ease-in-out 0s);
        background-color: $blue-s3;
        border: 1px solid $blue-s3;
        color: $white;
      }

      &.inactive {
        visibility: hidden;
      }
    }

    .setting-help {
699
      @extend %t-copy-sub2;
700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740
      display: inline-block;
      font-color: $gray-l6;
      min-width: ($baseline*10);
      vertical-align: top;
    }



    // TYPE: enumerated lists of metadata sets
    .metadata-list-enum {

      * {
        @include box-sizing(border-box);
      }

      // label
      .setting-label {
        vertical-align: top;
        margin-top: ($baseline/2);
      }

      // inputs and labels
      .wrapper-list-settings {
        @include size(45%,100%);
        display: inline-block;
        min-width: ($baseline*5);

        // enumerated fields
        .list-settings {
          margin: 0;

          .list-settings-item {
            margin-bottom: ($baseline/2);
          }

          // inputs
          .input {
            width: 80%;
            margin-right: ($baseline/2);
            vertical-align: middle;
          }
741
        }
742 743
      }

744 745 746 747 748 749 750 751
      .setting-clear {
        vertical-align: top;
        margin-top: ($baseline/4);
      }

      .create-setting {
        @extend %ui-btn-flat-outline;
        @extend %t-action3;
752
        @extend %t-strong;
753 754 755 756
        display: block;
        width: 100%;
        padding: ($baseline/2);

757
        .icon {
758 759 760 761 762
          margin-right: ($baseline/4);
        }
      }

      .remove-setting {
763
        @include transition(color $tmg-f2 ease-in-out);
764
        @extend %t-action1;
765 766 767
        display: inline-block;
        background: transparent;
        color: $blue-l3;
768

769 770
        &:hover {
          color: $blue;
771
        }
772 773
      }
    }
774

775 776 777 778 779
    // TYPE: Dict
    .metadata-dict {
      * {
        @include box-sizing(border-box);
      }
780

781 782 783
      // label
      .setting-label {
          vertical-align: top;
784
          margin-top: ($baseline*0.75);
785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816
      }

      // inputs and labels
      .wrapper-dict-settings {
        width: 55%;
        display: inline-block;
        min-width: 240px;

        // enumerated fields
        .list-settings {
          margin: ($baseline/2) 0 0;

          .list-settings-item {
            margin-bottom: ($baseline/2);
          }

          // inputs
          .input {
            width: 43%;
            margin-right: ($baseline/4);
            vertical-align: middle;
            display: inline-block;

            &.input-value {
              margin-right: ($baseline/2);
            }
          }
        }
      }

      .setting-clear {
        vertical-align: top;
817
        margin: ($baseline*0.75) 0 0 0;
818 819 820 821 822
      }

      .create-setting {
        @extend %ui-btn-flat-outline;
        @extend %t-action3;
823
        @extend %t-strong;
824 825 826 827
        display: block;
        width: 88%;
        padding: ($baseline/2);

828
        .icon {
829 830 831 832 833
          margin-right: ($baseline/4);
        }
      }

      .remove-setting {
834
        @include transition(color $tmg-f2 ease-in-out);
835
        @extend %t-action1;
836 837 838 839 840 841 842 843 844
        display: inline-block;
        background: transparent;
        color: $blue-l3;

        &:hover {
          color: $blue;
        }
      }
    }
845
  }
846
}
847

848 849 850 851

// +Case - Special Xblock Type Overrides
// ====================
// TO-DO - remove this reset styling from base _xblocks.scss file
852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873

// Latex Compiler
// make room for the launch compiler button
.wrapper-comp-editor.latex-problem {
  margin-top: ($baseline*2.5);
}

// sadly this button is outside the wrapper for the latex-problem so we can't get more specific with the class rule - ugh
.launch-latex-compiler {
  position: absolute;
  width: 100%;
  top: 0;
  background-color: $white;
  padding: $baseline/2 0 $baseline/2 $baseline;
  border-bottom: 1px solid $gray-l2;
}

//  hides latex compiler button if settings mode is-active - double ugh
div.wrapper-comp-editor.is-inactive ~ div.launch-latex-compiler {
  display: none;
}

874 875 876 877

.wrapper-xblock {

    .discussion-preview {
878
      color: $gray-l1;
879 880 881
      font-style: italic;
    }
}
882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974

// CASE: xblock license settings
.wrapper-license {

  .license-types {
    text-align: center;
    vertical-align: middle;
    display: inline-block;

    .license-type {
      display: inline-block;
    }

    .action.license-button {
      @include grey-button;
      @extend %t-action2;
      display: inline-block;
      text-align: center;
      width: 220px;
      height: 40px;
      cursor: pointer;

      &.is-selected {
        @include blue-button;
      }
    }

    .tip {
      @extend %t-copy-sub2;
    }
  }
  
  .wrapper-license-options {
    margin-bottom: ($baseline/2);

    .tip {
      @extend %t-copy-sub2;
    }
    .license-options {
      padding-bottom: ($baseline/2);

      .license-option {
        line-height: 1.5;
        border-bottom: 1px solid $gray-l4;
        padding: ($baseline/2) 0 ($baseline*0.4);

        &.is-clickable {
          cursor: pointer;
        }

        &:last-child {
          border-bottom: none;
        }

        input[type=checkbox] {
          vertical-align: top;
          width: auto;
          min-width: auto;
          height: auto;
          border: 0;
          margin: ($baseline*0.15) 15px 0px;
        }

        .option-name {
          @extend %t-action3;
          @extend %t-strong;
          display: inline-block;
          width: 15%;
          vertical-align: top;
          cursor: pointer;
        }
        .explanation {
          @extend %t-action4;
          display: inline-block;
          width: 75%;
          vertical-align: top;
          color: $gray;
        }
      }
    }
  }
  .license-preview a {
    color: $gray;

    &:hover {
      color: $ui-link-color;
    }
  }
  .list-input.settings-list ul.license-options li {
    // to make sure the padding is correctly overridden
    padding: ($baseline / 2) 0 ($baseline * 0.4);
  }
}