BigW Consortium Gitlab

diff.scss 8.04 KB
Newer Older
1
// Common
2
.diff-file {
3
  border: 1px solid $border-color;
4
  margin-bottom: $gl-padding;
Annabel Dunstone committed
5
  border-radius: 3px;
6

7
  .commit-short-id {
8
    font-family: $regular_font;
9 10 11
    font-weight: 400;
  }

12
  .diff-header {
13 14 15
    position: relative;
    background: $background-color;
    border-bottom: 1px solid $border-color;
16
    padding: 10px 16px;
17
    color: #555;
18
    z-index: 10;
Annabel Dunstone committed
19
    border-radius: 3px 3px 0 0;
20

21
    .diff-title {
22
      font-family: $monospace_font;
23 24
      word-break: break-all;
      display: block;
25 26 27 28

      .file-mode {
        color: #777;
      }
29 30 31 32 33 34 35 36 37 38
    }

    .commit-short-id {
      font-family: $monospace_font;
      font-size: smaller;
    }
  }
  .diff-content {
    overflow: auto;
    overflow-y: hidden;
39
    background: #fff;
40
    color: #333;
Annabel Dunstone committed
41
    border-radius: 0 0 3px 3px;
42
    -webkit-overflow-scrolling: auto;
43

skv committed
44 45 46
    .unfold {
      cursor: pointer;
    }
47

48 49 50 51 52
    .file-mode-changed {
      padding: 10px;
      color: #777;
    }

53 54 55 56 57 58 59 60 61 62 63
    .suppressed-container {
      padding: ($padding-base-vertical + 5px) $padding-base-horizontal;
      text-align: center;

      // "Changes suppressed. Click to show." link
      .show-suppressed-diff {
        font-size: 110%;
        font-weight: bold;
      }
    }

64 65 66 67
    table {
      width: 100%;
      font-family: $monospace_font;
      border: none;
68
      border-collapse: separate;
69 70
      margin: 0;
      padding: 0;
71

72
      .line_holder td {
73 74
        line-height: $code_line_height;
        font-size: $code_font_size;
75

76 77 78 79 80 81 82 83
        &.noteable_line {
          position: relative;

          &.old {
            &:before {
              content: '-';
              position: absolute;
            }
84
          }
85

86 87 88 89 90
          &.new {
            &:before {
              content: '+';
              position: absolute;
            }
91
          }
92 93
        }

94
        span {
95
          white-space: pre-wrap;
96
        }
97
      }
98
    }
99

100
    tr.line_holder.parallel {
101
      .old_line, .new_line {
102 103 104
        min-width: 50px;
      }

105
      td.line_content.parallel {
106 107 108 109 110
        width: 46%;
      }

      .add-diff-note {
        margin-left: -65px;
111
      }
112 113
    }

114
    .old_line, .new_line {
115 116
      margin: 0;
      padding: 0;
117
      border: none;
118
      padding: 0 5px;
119
      border-right: 1px solid;
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
      text-align: right;
      min-width: 35px;
      max-width: 50px;
      width: 35px;
      @include user-select(none);
      a {
        float: left;
        width: 35px;
        font-weight: normal;
        &:hover {
          text-decoration: underline;
        }
      }
    }
    .line_content {
      display: block;
136 137
      margin: 0;
      padding: 0 0.5em;
138
      border: none;
139

140 141
      &.parallel {
        display: table-cell;
142 143 144 145

        span {
          word-break: break-all;
        }
146 147
      }
    }
148 149 150 151

    .text-file.diff-wrap-lines table .line_holder td span {
      white-space: pre-wrap;
    }
152 153 154 155 156
  }
  .image {
    background: #ddd;
    text-align: center;
    padding: 30px;
157
    .wrap {
158 159 160 161 162 163 164
      display: inline-block;
    }

    .frame {
      display: inline-block;
      background-color: #fff;
      line-height: 0;
165
      img {
166
        border: 1px solid #fff;
167
        background: image-url('trans_bg.gif');
168 169 170 171 172 173 174 175 176 177
        max-width: 100%;
      }
      &.deleted {
        border: 1px solid $deleted;
      }

      &.added {
        border: 1px solid $added;
      }
    }
178
    .image-info {
179
      font-size: 12px;
180
      margin: 5px 0 0;
181 182 183
      color: grey;
    }

184
    .view.swipe {
185 186
      position: relative;

187
      .swipe-frame {
188 189 190 191
        display: block;
        margin: auto;
        position: relative;
      }
192
      .swipe-wrap {
193 194 195 196 197 198 199
        overflow: hidden;
        border-left: 1px solid #999;
        position: absolute;
        display: block;
        top: 13px;
        right: 7px;
      }
200
      .frame {
201 202 203
        top: 0;
        right: 0;
        position: absolute;
204
        &.deleted {
205 206 207 208 209 210
          margin: 0;
          display: block;
          top: 13px;
          right: 7px;
        }
      }
211
      .swipe-bar {
212 213 214 215 216 217
        display: block;
        height: 100%;
        width: 15px;
        z-index: 100;
        position: absolute;
        cursor: pointer;
218 219
        &:hover {
          .top-handle {
220 221
            background-position: -15px 3px;
          }
222
          .bottom-handle {
223 224
            background-position: -15px -11px;
          }
225 226
        }
        .top-handle {
227 228 229 230
          display: block;
          height: 14px;
          width: 15px;
          position: absolute;
231
          top: 0;
232
          background: image-url('swipemode_sprites.gif') 0 3px no-repeat;
233
        }
234
        .bottom-handle {
235 236 237 238
          display: block;
          height: 14px;
          width: 15px;
          position: absolute;
239
          bottom: 0;
240
          background: image-url('swipemode_sprites.gif') 0 -11px no-repeat;
241 242
        }
      }
243 244 245 246
    }
    //.view.swipe
    .view.onion-skin {
      .onion-skin-frame {
247 248 249 250 251 252 253
        display: block;
        margin: auto;
        position: relative;
      }
      .frame.added, .frame.deleted {
        position: absolute;
        display: block;
254 255
        top: 0;
        left: 0;
256
      }
257
      .controls {
258 259 260 261 262
        display: block;
        height: 14px;
        width: 300px;
        z-index: 100;
        position: absolute;
263
        bottom: 0;
264 265 266
        left: 50%;
        margin-left: -150px;

267
        .drag-track {
268 269 270 271 272
          display: block;
          position: absolute;
          left: 12px;
          height: 10px;
          width: 276px;
273
          background: image-url('onion_skin_sprites.gif') -4px -20px repeat-x;
274 275 276 277 278
        }

        .dragger {
          display: block;
          position: absolute;
279 280
          left: 0;
          top: 0;
281 282
          height: 14px;
          width: 14px;
283
          background: image-url('onion_skin_sprites.gif') 0 -34px repeat-x;
284 285 286 287 288 289 290
          cursor: pointer;
        }

        .transparent {
          display: block;
          position: absolute;
          top: 2px;
291
          right: 0;
292 293
          height: 10px;
          width: 10px;
294
          background: image-url('onion_skin_sprites.gif') -2px 0 no-repeat;
295 296 297 298 299 300
        }

        .opaque {
          display: block;
          position: absolute;
          top: 2px;
301
          left: 0;
302 303
          height: 10px;
          width: 10px;
304
          background: image-url('onion_skin_sprites.gif') -2px -10px no-repeat;
305 306
        }
      }
307 308
    }
    //.view.onion-skin
309
  }
310
  .view-modes {
311 312
    padding: 10px;
    text-align: center;
313
    background: #eee;
314

315
    ul, li {
316 317 318 319 320 321
      list-style: none;
      margin: 0;
      padding: 0;
      display: inline-block;
    }

322
    li {
323 324 325 326
      color: grey;
      border-left: 1px solid #c1c1c1;
      padding: 0 12px 0 16px;
      cursor: pointer;
327
      &:first-child {
328 329
        border-left: none;
      }
330
      &:hover {
331 332
        text-decoration: underline;
      }
333 334
      &.active {
        &:hover {
335 336 337 338 339
          text-decoration: none;
        }
        cursor: default;
        color: #333;
      }
340
      &.disabled {
341 342 343 344 345
        display: none;
      }
    }
  }
}
346 347 348 349 350

.file-content .diff-file {
  margin: 0;
  border: none;
}
351 352

.diff-file .line_content {
353
  white-space: pre-wrap;
354 355 356 357 358 359
}

.diff-wrap-lines .line_content {
  white-space: pre-wrap;
}

360 361 362
.inline-parallel-buttons {
  float: right;
}
363

Annabel Dunstone committed
364 365 366 367 368 369
.diffs {
  .content-block {
    border-bottom: none;
  }
}

Annabel Dunstone committed
370 371 372 373
.files-changed {
  border-bottom: none;
}

374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406
// Mobile
@media (max-width: 480px) {
  .diff-title {
    margin: 0;

    .file-mode {
      display: none;
    }
  }

  .diff-controls {
    position: static;
    text-align: center;
  }
}

// Bigger screens
@media (min-width: 481px) {
  .diff-title {
    margin-right: 200px;

    .file-mode {
      margin-left: 10px;
    }
  }

  .diff-controls {
    float: right;
    position: absolute;
    top: 5px;
    right: 15px;
  }
}
407

408 409
@mixin diff_background($background, $idiff, $border) {
  background: $background;
410

411 412
  &.line_content span.idiff {
    background: $idiff;
413 414
  }

415 416
  &.diff-line-num {
    border-color: $border;
417 418
  }
}
419 420 421 422 423 424 425 426

.files {
  margin-top: -1px;

  .diff-file:last-child {
    margin-bottom: 0;
  }
}
427

428 429 430 431
.file-holder {
  .diff-line-num:not(.js-unfold-bottom) {
    a {
      &:before {
432
        content: attr(data-linenumber);
433 434 435 436 437 438 439 440 441 442 443
      }
    }
  }
}

.discussion {
  .diff-content {
    .diff-line-num {
      &:before {
        content: attr(data-linenumber);
      }
444 445 446
    }
  }
}