_header.scss 8.21 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
// Open edX: Studio header
// =======================
//
// Note: these styles replicate the Studio styles directly
// rather than benefiting from any Bootstrap classes. Ideally
// the header should be reimagined using Bootstrap and then
// these styles will no longer be necessary.

// studio - elements - global header
// ====================

.wrapper-header {
  @extend %ui-depth3;
14

15 16 17 18 19 20 21 22 23
  position: relative;
  width: 100%;
  box-shadow: 0 1px 2px 0 $shadow-l1;
  margin: 0;
  padding: 0 $baseline;
  background: $white;

  header.primary {
    @include clearfix();
24

25 26 27 28 29 30 31 32
    max-width: $studio-max-width;
    width: flex-grid(12);
    margin: 0 auto;
  }

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

  // basic layout
33 34
  .wrapper-l,
  .wrapper-r {
35 36 37 38 39
    background: $white;
  }

  .wrapper-l {
    float: left;
40
    width: flex-grid(7, 12);
41 42 43 44
  }

  .wrapper-r {
    float: right;
45
    width: flex-grid(4, 12);
46 47 48
    text-align: right;
  }

49 50 51 52 53
  .branding,
  .info-course,
  .nav-course,
  .nav-account,
  .nav-pitch {
54 55
    display: inline-block;
    vertical-align: middle;
56
    margin-bottom: 0;
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
  }

  .user-language-selector {
    width: 120px;
    display: inline-block;
    margin: 0 10px 0 5px;
    vertical-align: sub;

    .language-selector {
      width: 120px;
    }
  }

  .nav-account {
    width: auto;
  }

  // basic layout - nav items
  nav {
    > ol > .nav-item {
      @extend %t-action3;
      @extend %t-strong;
79

80 81 82 83 84 85 86 87 88
      display: inline-block;
      vertical-align: middle;

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

    .nav-item a {
89
      color: color("gray");
90 91 92 93 94 95 96 97 98 99

      &:hover {
        color: $link-hover-color;
      }
    }
  }

  // basic layout - dropdowns
  .nav-dd {
    .title {
100 101
      padding: $baseline/2 $baseline/2;
      font-size: $font-size-lg;
102 103 104 105 106 107 108

      .fa-caret-down {
        opacity: 0.25;
      }

      &:hover {
        .fa-caret-down {
109
          opacity: 1;
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
        }
      }

      .nav-sub .nav-item {
        .icon {
          display: inline-block;
          vertical-align: middle;
          margin-right: ($baseline/4);
        }
      }
    }
  }

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

  // specific elements - branding
  .branding {
    padding: ($baseline*0.75) 0;

    a {
      display: block;

      img {
        max-height: ($baseline*2);
        display: block;
      }
    }
  }

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

  // specific elements - course name/info
  .info-course {
    margin-right: flex-gutter();
144
    border-right: 1px solid $gray-300;
145 146
    padding: ($baseline*0.75) flex-gutter() ($baseline*0.75) 0;

147 148
    .course-org,
    .course-number {
149
      font-size: $font-size-sm;
150 151 152 153 154 155 156
      line-height: 12px;
      display: inline-block;
      vertical-align: middle;
      max-width: 45%;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
157
      opacity: 1;
158
      color: theme-color("primary");
159 160 161 162 163 164 165 166 167
    }

    .course-org {
      margin-right: $baseline/4;
    }

    .course-title {
      @extend %t-action2;
      @extend %t-strong;
168

169 170 171 172 173 174 175 176 177 178
      display: block;
      width: 100%;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }

    // entire link
    .course-link {
      display: block;
179
      color: theme-color("primary");
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226

      &:hover {
        color: $link-hover-color;
      }
    }
  }

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

  // specific elements - course nav
  .nav-course {
    padding: ($baseline*0.75) 0;
  }

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

  // specific elements - account-based nav
  .nav-account {
    position: relative;
    padding: ($baseline*0.75) 0;

    .nav-sub {
      text-align: left;
    }

    .nav-account-help {
      .wrapper-nav-sub {
        width: ($baseline*10);
      }
    }

    .nav-account-user {
      .title {
        max-width: ($baseline*6.5);

        > .label {
          display: inline-block;
          max-width: 84%;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
        }
      }
    }

    .settings-language-form {
      margin-top: 4px;
227

228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
      .language-selector {
        width: 130px;
      }
    }
  }

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

  // specific elements - pitch/how it works nav
  .nav-pitch {
    position: relative;
    padding: ($baseline*0.75) 0;

    .nav-sub {
      text-align: left;
    }
  }
}

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

// CASE: user signed in
.is-signedin {
  .wrapper-l {
252
    width: flex-grid(8, 12);
253 254 255
  }

  .wrapper-r {
256
    width: flex-grid(4, 12);
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273
  }

  .branding {
    margin-right: 2%;
  }

  .nav-account {
    top: ($baseline/4);
  }
}

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

// CASE: in course {
.is-signedin.course {
  .wrapper-header {
    .wrapper-l {
274
      width: flex-grid(9, 12);
275 276 277
    }

    .wrapper-r {
278
      width: flex-grid(3, 12);
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
    }

    .branding {
      margin-right: 2%;
    }

    .info-course {
      width: 25%;
      margin-right: 2%;
    }

    .nav-course {
      width: 45%;
    }
  }
}

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

// CASE: user not signed in
.not-signedin,
.view-util {
  .wrapper-header {
    .wrapper-l {
303
      width: flex-grid(2, 12);
304 305 306
    }

    .wrapper-r {
307
      width: flex-grid(10, 12);
308 309 310 311 312 313 314 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
    }

    .branding {
      width: 100%;
    }

    .nav-pitch {
      top: ($baseline/4);

      .nav-item {
        margin-right: ($baseline/2);

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

      .action-signup {
        padding: ($baseline/4) ($baseline/2);
        text-transform: uppercase;
      }

      .action-signin {
        padding: ($baseline/4) ($baseline/2);
        text-transform: uppercase;
      }
    }
  }
}

// dropdown
.nav-dd {
  .title {
341 342
    .label,
    .fa-caret-down {
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
      display: inline-block;
      vertical-align: middle;
    }

    .ui-toggle-dd {
      margin: 0;
      display: inline-block;
      vertical-align: middle;
    }

    // dropped down state
    &.is-selected {
      .ui-toggle-dd {
        transform: rotate(-180deg);
        transform-origin: 50% 50%;
      }
    }
  }

  .nav-item {
    position: relative;

    &.nav-course-settings {
      .wrapper-nav-sub {
        width: ($baseline*9);
      }
    }
  }

  .wrapper-nav-sub {
    position: absolute;
    top: ($baseline*2.5);
375
    opacity: 0;
376 377 378 379 380 381 382 383
    pointer-events: none;
    width: ($baseline*8);
    overflow: hidden;
    height: 0;


    // dropped down state
    &.is-shown {
384
      opacity: 1;
385 386 387 388 389 390 391 392 393 394 395
      pointer-events: auto;
      overflow: visible;
      height: auto;
    }
  }

  .nav-sub {
    border-radius: 2px;
    box-shadow: 0 1px 1px $shadow-l1;
    position: relative;
    width: 100%;
396
    border: 1px solid $gray-500;
397 398 399
    padding: ($baseline/2) ($baseline*0.75);
    background: $white;

400 401
    &::after,
    &::before {
402 403 404 405 406 407 408 409 410 411
      bottom: 100%;
      border: solid transparent;
      content: " ";
      height: 0;
      width: 0;
      position: absolute;
      pointer-events: none;
    }

    // ui triangle/nub
412
    &::after {
413 414 415 416 417
      border-color: rgba(255, 255, 255, 0);
      border-bottom-color: $white;
      border-width: 10px;
    }

418
    &::before {
419
      border-color: rgba(178, 178, 178, 0);
420
      border-bottom-color: $gray-500;
421 422 423 424 425 426
      border-width: 11px;
    }

    .nav-item {
      @extend %t-action3;
      @extend %t-regular;
427

428 429
      display: block;
      margin: 0 0 ($baseline/4) 0;
430
      border-bottom: 1px solid $gray-300;
431 432 433 434 435 436 437 438
      padding: 0 0($baseline/4) 0;

      &:last-child {
        margin-bottom: 0;
        border-bottom: none;
        padding-bottom: 0;
      }

439 440 441 442
      h3 {
        font-size: $font-size-lg;
      }

443 444
      a {
        display: block;
445 446 447
        color: $body-color;
        font-size: $font-size-lg;
        font-weight: 600;
448

449 450
        &:hover,
        &:active {
451
          color: theme-color("primary");
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466
        }
      }
    }
  }

  // CASE: left-hand side arrow/dd
  &.ui-left {
    .wrapper-nav-sub {
      left: 0;
    }

    .nav-sub {
      text-align: left;

      // ui triangle/nub
467
      &::after {
468 469 470 471
        left: $baseline;
        margin-left: -10px;
      }

472
      &::before {
473 474 475 476 477 478 479 480
        left: $baseline;
        margin-left: -11px;
      }
    }
  }

  // CASE: right-hand side arrow/dd
  &.ui-right {
481 482 483 484
    > ol {
      margin-bottom: 0;
    }

485 486 487 488 489 490 491 492
    .wrapper-nav-sub {
      left: none;
      right: 0;
    }

    .nav-sub {

      // ui triangle/nub
493
      &::after {
494 495 496 497
        right: $baseline;
        margin-right: -10px;
      }

498
      &::before {
499 500 501 502 503 504
        right: $baseline;
        margin-right: -11px;
      }
    }
  }
}