BigW Consortium Gitlab

diff.scss 8.17 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 168 169 170
        background-image: linear-gradient(45deg, #e5e5e5 25%, transparent 25%, transparent 75%, #e5e5e5 75%, #e5e5e5 100%),
        linear-gradient(45deg, #e5e5e5 25%, transparent 25%, transparent 75%, #e5e5e5 75%, #e5e5e5 100%);
        background-size: 10px 10px;
        background-position: 0 0, 5px 5px;
171 172 173 174 175 176 177 178 179 180
        max-width: 100%;
      }
      &.deleted {
        border: 1px solid $deleted;
      }

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

187
    .view.swipe {
188 189
      position: relative;

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

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

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

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

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

318
    ul, li {
319 320 321 322 323 324
      list-style: none;
      margin: 0;
      padding: 0;
      display: inline-block;
    }

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

.file-content .diff-file {
  margin: 0;
  border: none;
}
354 355

.diff-file .line_content {
356
  white-space: pre-wrap;
357 358 359 360 361 362
}

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

363 364 365
.inline-parallel-buttons {
  float: right;
}
366

Annabel Dunstone committed
367 368 369 370 371 372
.diffs {
  .content-block {
    border-bottom: none;
  }
}

Annabel Dunstone committed
373 374 375 376
.files-changed {
  border-bottom: none;
}

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 407 408 409
// 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;
  }
}
410

411 412
@mixin diff_background($background, $idiff, $border) {
  background: $background;
413

414 415
  &.line_content span.idiff {
    background: $idiff;
416 417
  }

418 419
  &.diff-line-num {
    border-color: $border;
420 421
  }
}
422 423 424 425 426 427 428 429

.files {
  margin-top: -1px;

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

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