BigW Consortium Gitlab

diff.scss 7.85 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

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

16
    .diff-title {
17
      font-family: $monospace_font;
18 19
      word-break: break-all;
      display: block;
20 21 22 23

      .file-mode {
        color: #777;
      }
24 25 26 27 28 29 30 31 32 33
    }

    .commit-short-id {
      font-family: $monospace_font;
      font-size: smaller;
    }
  }
  .diff-content {
    overflow: auto;
    overflow-y: hidden;
34
    background: #fff;
35
    color: #333;
Annabel Dunstone committed
36
    border-radius: 0 0 3px 3px;
37
    -webkit-overflow-scrolling: auto;
38

skv committed
39 40 41
    .unfold {
      cursor: pointer;
    }
42

43 44 45 46 47
    .file-mode-changed {
      padding: 10px;
      color: #777;
    }

48 49 50 51 52 53 54 55 56 57 58
    .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;
      }
    }

59 60 61 62
    table {
      width: 100%;
      font-family: $monospace_font;
      border: none;
63
      border-collapse: separate;
64 65
      margin: 0;
      padding: 0;
66

67
      .line_holder td {
68 69
        line-height: $code_line_height;
        font-size: $code_font_size;
70

71 72 73 74 75 76 77 78
        &.noteable_line {
          position: relative;

          &.old {
            &:before {
              content: '-';
              position: absolute;
            }
79
          }
80

81 82 83 84 85
          &.new {
            &:before {
              content: '+';
              position: absolute;
            }
86
          }
87 88
        }

89
        span {
90
          white-space: pre-wrap;
91
        }
92
      }
93
    }
94

95
    tr.line_holder.parallel {
96
      .old_line, .new_line {
97 98 99
        min-width: 50px;
      }

100
      td.line_content.parallel {
101 102
        width: 50%;
      }
103 104
    }

105
    .old_line, .new_line {
106 107
      margin: 0;
      padding: 0;
108
      border: none;
109
      padding: 0 5px;
110
      border-right: 1px solid;
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
      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;
127 128
      margin: 0;
      padding: 0 0.5em;
129 130 131 132 133
      border: none;
      &.parallel {
        display: table-cell;
      }
    }
134 135 136 137

    .text-file.diff-wrap-lines table .line_holder td span {
      white-space: pre-wrap;
    }
138 139 140 141 142
  }
  .image {
    background: #ddd;
    text-align: center;
    padding: 30px;
143
    .wrap {
144 145 146 147 148 149 150
      display: inline-block;
    }

    .frame {
      display: inline-block;
      background-color: #fff;
      line-height: 0;
151
      img {
152
        border: 1px solid #fff;
153
        background: image-url('trans_bg.gif');
154 155 156 157 158 159 160 161 162 163
        max-width: 100%;
      }
      &.deleted {
        border: 1px solid $deleted;
      }

      &.added {
        border: 1px solid $added;
      }
    }
164
    .image-info {
165
      font-size: 12px;
166
      margin: 5px 0 0;
167 168 169
      color: grey;
    }

170
    .view.swipe {
171 172
      position: relative;

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

253
        .drag-track {
254 255 256 257 258
          display: block;
          position: absolute;
          left: 12px;
          height: 10px;
          width: 276px;
259
          background: image-url('onion_skin_sprites.gif') -4px -20px repeat-x;
260 261 262 263 264
        }

        .dragger {
          display: block;
          position: absolute;
265 266
          left: 0;
          top: 0;
267 268
          height: 14px;
          width: 14px;
269
          background: image-url('onion_skin_sprites.gif') 0 -34px repeat-x;
270 271 272 273 274 275 276
          cursor: pointer;
        }

        .transparent {
          display: block;
          position: absolute;
          top: 2px;
277
          right: 0;
278 279
          height: 10px;
          width: 10px;
280
          background: image-url('onion_skin_sprites.gif') -2px 0 no-repeat;
281 282 283 284 285 286
        }

        .opaque {
          display: block;
          position: absolute;
          top: 2px;
287
          left: 0;
288 289
          height: 10px;
          width: 10px;
290
          background: image-url('onion_skin_sprites.gif') -2px -10px no-repeat;
291 292
        }
      }
293 294
    }
    //.view.onion-skin
295
  }
296
  .view-modes {
297 298
    padding: 10px;
    text-align: center;
299
    background: #eee;
300

301
    ul, li {
302 303 304 305 306 307
      list-style: none;
      margin: 0;
      padding: 0;
      display: inline-block;
    }

308
    li {
309 310 311 312
      color: grey;
      border-left: 1px solid #c1c1c1;
      padding: 0 12px 0 16px;
      cursor: pointer;
313
      &:first-child {
314 315
        border-left: none;
      }
316
      &:hover {
317 318
        text-decoration: underline;
      }
319 320
      &.active {
        &:hover {
321 322 323 324 325
          text-decoration: none;
        }
        cursor: default;
        color: #333;
      }
326
      &.disabled {
327 328 329 330 331
        display: none;
      }
    }
  }
}
332 333 334 335 336

.file-content .diff-file {
  margin: 0;
  border: none;
}
337 338

.diff-file .line_content {
339
  white-space: pre-wrap;
340 341 342 343 344 345
}

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

346 347 348
.inline-parallel-buttons {
  float: right;
}
349

Annabel Dunstone committed
350 351 352 353 354 355
.diffs {
  .content-block {
    border-bottom: none;
  }
}

Annabel Dunstone committed
356 357 358 359
.files-changed {
  border-bottom: none;
}

360 361 362 363 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
// 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;
  }
}
393

394 395
@mixin diff_background($background, $idiff, $border) {
  background: $background;
396

397 398
  &.line_content span.idiff {
    background: $idiff;
399 400
  }

401 402
  &.diff-line-num {
    border-color: $border;
403 404
  }
}
405 406 407 408 409 410 411 412

.files {
  margin-top: -1px;

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

414 415 416 417
.file-holder {
  .diff-line-num:not(.js-unfold-bottom) {
    a {
      &:before {
418
        content: attr(data-linenumber);
419 420 421 422 423 424 425 426 427 428 429
      }
    }
  }
}

.discussion {
  .diff-content {
    .diff-line-num {
      &:before {
        content: attr(data-linenumber);
      }
430 431 432
    }
  }
}