_student-notes.scss 8.34 KB
Newer Older
1 2 3 4 5
// LMS -- modules -- student notes
// ====================

// in this document:
// --------------------
6
// +extends
7 8 9 10 11 12 13 14
// +notes
// +local variables/utilities
// +toggling notes
// +individual note (in context)
// +creating/editing notes
// +listing notes
// +necessary, but ugly overrides

15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
// +extends:
// --------------------
%bubble {
  @include transform(rotate(45deg));
  @include left(12px);
  position: absolute;
  bottom: -($baseline/2);
  display: block;
  width: 16px;
  height: 16px;
  content: " ";
  background: $white; // Set a default
  border-bottom: 1px solid $gray-l2;
  border-right: 1px solid $gray-l2;
}

31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 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 111 112 113 114 115 116 117 118 119 120
// +notes:
// --------------------
// this Sass partial contains all of the styling needed for the in-line student notes UI.

// +local variables/utilities:
// --------------------
$notes-annotator-background-light: rgb(251, 251, 251); // taken from annotatorJS base colors
$notes-annotator-background-med: rgb(214, 214, 214); // taken from annotatorJS base colors
$notes-annotator-background-dark: rgba(122,122,122,0.6); // taken from annotatorJS base colors

%notes-reset-background {
  background-image: none !important;
  background-repeat: none !important;
  background-position: 0 0 !important;
}

%notes-reset-font {
  font-family: $f-sans-serif !important;
  font-style: normal !important;
  font-weight: $font-regular !important;
}

%notes-reset-icon {
  font-family: FontAwesome !important;
  font-style: normal !important;
  text-indent: 0 !important;
}

%notes-bubble {
  border: ($baseline/20) solid $notes-annotator-background-dark !important;
  border-radius: ($baseline/10);
  box-shadow: 0 ($baseline/10) 0 ($baseline/20) $shadow-l2 !important;
  background: $notes-annotator-background-light !important; // syncing to vendor triangle color
}

// +toggling notes
// --------------------
.edx-notes-visibility {

  .edx-notes-visibility-error {
    @extend %t-copy-sub2;
    @extend %text-truncated;
    position: relative;
    bottom: -($baseline/20); // needed to sync up with current rogue/more complex calc utility alignment
    max-width: ($baseline*15);
    display: none;
    vertical-align: bottom;
    @include margin-right(-($baseline/4));
    @include border-right(($baseline/4) solid $error-color);
    padding: ($baseline/2) $baseline;
    background: $black-t3;
    text-align: center;
    color: $white;
  }

  // STATE: has error
  &.has-error {

    .edx-notes-visibility-error {
      display: inline-block;
    }

    .utility-control {
      color: $error-color;
    }
  }
}

// CASE: annotator error in toggling notes (vendor customization)
.annotator-notice {
  @extend %t-weight4;
  @extend %t-copy-sub1;
  padding: ($baseline/4) $baseline;
  background: $black-t3;
}

// CASE: annotator error in toggling notes
// vendor customization
.annotator-notice {
  @extend %t-weight4;
  @extend %t-copy-sub1;
  padding: ($baseline/2) $baseline;
  background: $gray-d4;
}

// vendor customization
.annotator-notice-error {
  border-color: $error-color;
}

121 122 123 124
.edx-notes-focus-grabber {
  outline: none;
}

125 126 127 128 129 130 131
.edx-notes-wrapper {
  // +individual note (in context)
  // --------------------
  .annotator-outer {
    @extend %ui-depth4;
    @extend %notes-reset-font;
  }
132

133 134 135 136
  // bubble
  .annotator-widget.annotator-widget {
    @extend %notes-bubble;
  }
137

138 139 140
  .annotator-listing {
    padding: 0 !important;
    margin: 0 !important;
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155

    .annotator-widget {
      &:after {
        @extend %bubble;
      }
    }
  }

  .annotator-editor {
    .annotator-widget {
      &:after {
        @extend %bubble;
        background: $gray-l5;
      }
    }
156
  }
157

158 159 160 161
  .annotator-item {
    padding: ($baseline/2) !important;
    margin-bottom: 0 !important;
  }
162

163 164 165 166 167 168
  // +creating/editing notes (overrides for vendor styling)
  // --------------------
  // adding
  .annotator-adder {
    @extend %notes-reset-background;
    @extend %ui-depth4;
169

170 171 172
    button {
      @extend %notes-bubble;
      position: relative;
173
      display: block;
174 175 176 177 178 179 180 181 182 183 184 185 186

      &:after {
        @extend %notes-reset-icon;
        @extend %shame-link-base;
        @include font-size(30);
        position: absolute;
        top: 35%;
        @include left(15%);
        content: "\f14b";
      }

      // using annotatorJS triangle styling for adder
      &:before {
187 188 189
        @extend %bubble;
        @include left(10px);
        background: whitesmoke;
190
      }
191 192 193
    }
  }

194 195 196 197 198 199
  // editing
  .annotator-editor {

    .annotator-controls {
      @include text-align(left);
      @include clearfix();
200 201
      @extend %ui-depth1;
      position: relative;
202 203 204
      padding: 8px;
      border: none !important;
      border-radius: 0 !important;
205 206
      background: $gray-l5 !important;
      font-family: $f-sans-serif !important;
207 208 209 210 211 212 213

      // actions
      .annotator-save, .annotator-cancel {
        @extend %notes-reset-background;
        padding: ($baseline/4) ($baseline/2) !important;
        border: none;
        box-shadow: none;
214 215
        font-family: $f-sans-serif !important;
        font-size: 14px !important;
216 217 218 219 220 221 222
        text-shadow: none !important;

        // removing vendor icons
        &:after {
          display: none !important;
        }
      }
223

224 225
      .annotator-save {
        @include float(left);
226 227
      }

228 229 230
      .annotator-cancel {
        background-color: $transparent !important;
      }
231 232
    }

233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
    .annotator-item {

      textarea {
        @extend %notes-reset-font;
        @extend %t-demi-strong;
        padding: ($baseline/5) !important;
        font-size: 14px !important;
        line-height: 22px !important;
        color: $gray-d3 !important;
        background: $notes-annotator-background-light !important; //matches annotator JS editing bubble triangle color

        // STATE: hover/focus
        &:hover, &:focus {
          background: $notes-annotator-background-light;
        }
      }
249 250 251 252
    }
  }


253 254 255 256 257 258 259 260 261
  // +listing notes (overrides for vendor styling)
  // --------------------
  // highlight
  .annotator-hl {
    background: $student-notes-highlight-color-focus;

    // CASE: a highlight contains a link
    a {
      color: $link-color;
262 263 264

      // STATE: hover/focus
      &:hover, &:focus {
265 266 267 268 269 270 271 272
        text-decoration: underline;
      }

      // STATE: disabled
      &:disabled, &.is-disabled {
        @extend %ui-disabled;
        opacity: 0.5;
        cursor: not-allowed;
273 274 275
      }
    }
  }
276

277 278
  // CASE: a link contains a highlight
  a .annotator-hl {
279 280 281 282 283 284
    color: $link-color;

    // STATE: hover/focus
    &:hover, &:focus {
      text-decoration: underline;
    }
285 286
  }

287 288
  // content
  .annotator-viewer {
289

290 291 292 293
    .annotator-widget.annotator-listing {
      outline: none;
    }

294 295 296 297 298 299 300 301
    // poorly scoped selector for content of a note's comment
    div:first-of-type {
      @extend %notes-reset-font;
      padding: ($baseline/4) !important;
      font-size: 14px !important;
      line-height: 22px !important;
      color: $gray-d2 !important;
    }
302

303 304
    // controls
    .annotator-controls {
305
      opacity: 1;
306 307 308 309 310 311
      // RTL support
      @include right(0);
      top: 0;
      @include float(right);
      @include padding-left($baseline/4);

312
      .annotator-edit, .annotator-delete, .annotator-close {
313 314 315 316 317 318 319 320 321 322
        position: relative;
        display: inline-block;
        vertical-align: middle;

        &:before {
          @extend %notes-reset-icon;
          @extend %shame-link-base;
          @extend %t-icon4;
          position: absolute;
        }
323 324
      }

325 326
      .annotator-edit {
        @include margin-right($baseline/2);
327

328 329 330
        &:before {
          top: 0;
          @include left(0);
331
          content: "\f040"; // .fa-pencil
332
        }
333 334
      }

335
      .annotator-delete {
336 337 338 339 340 341 342 343 344 345
        @include margin-right($baseline/3);

        &:before {
          top: -($baseline/20);
          @include left(0);
          content: "\f1f8"; // .fa-trash
        }
      }

      .annotator-close {
346

347 348 349
        &:before {
          top: -($baseline/20);
          @include left(0);
350
          content: "\f00d"; // .fa-close
351
        }
352 353 354 355 356 357 358 359 360 361 362
      }
    }
  }
}
// +necessary, but ugly overrides
// --------------------
.edx-notes-wrapper .annotator-wrapper.annotator-wrapper .annotator-outer.annotator-viewer .annotator-controls button {
  @extend %notes-reset-background;
  opacity: 1.0;
}

363
.edx-notes-wrapper .annotator-wrapper .annotator-editor.annotator-outer button.annotator-save {
364 365 366 367
  @extend %btn-inherited-primary;
  @extend %t-action2;
}

368
.edx-notes-wrapper .annotator-wrapper .annotator-editor.annotator-outer button.annotator-cancel {
369 370 371 372
  @extend %shame-link-base;
  @extend %t-action2;
  @extend %t-regular;
}