summaryrefslogtreecommitdiff
path: root/app/assets/stylesheets/highlight/common.scss
blob: bd327082e2052f365bb074ce0e5913bc2aa67f0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
@import '../framework/variables';
@import './conflict_colors';
@import 'page_bundles/mixins_and_variables_and_functions';

@mixin diff-background($background, $idiff, $border) {
  background: $background;

  &.line_content span.idiff {
    background: $idiff;
  }

  &.diff-line-num {
    border-color: $border;
  }
}

@mixin dark-diff-match-line {
  color: $dark-diff-match-bg;
  background: $dark-diff-match-color;
}

@mixin diff-expansion($background, $border, $link) {
  background-color: $background;

  .diff-td,
  td {
    border-top: 1px solid $border;
    border-bottom: 1px solid $border;
  }

  button {
    color: $link;
    border: 0;
    background: transparent;

    &[disabled] {
      color: desaturate($link, 100%);
      opacity: 0.5;
      cursor: default;
    }

    &:hover:not([disabled]) {
      text-decoration: underline;
    }

    &:not(:focus-visible) {
      outline: 0;
    }
  }
}

@mixin line-coverage-border-color($coverage, $no-coverage) {
  transition: border-left 0.1s ease-out;

  &.coverage {
    border-left: 2px solid $coverage;
  }

  &.no-coverage {
    border-left: 4px solid $no-coverage;
  }
}

@mixin line-number-hover {
  background-color: $purple-100;
  border-color: $purple-200;

  a {
    color: $gray-600;
  }
}

@mixin conflict-colors($theme) {
  .diff-line-num {
    &.conflict_marker_our,
    &.conflict_our {
      background-color: map-get($conflict-colors, #{$theme}-header-head-neutral);
      border-color: map-get($conflict-colors, #{$theme}-header-head-neutral);
    }

    &.conflict_marker_their,
    &.conflict_their {
      background-color: map-get($conflict-colors, #{$theme}-header-origin-neutral);
      border-color: map-get($conflict-colors, #{$theme}-header-origin-neutral);
    }
  }

  .line_holder {
    .line_content,
    .line-coverage {
      &.conflict_marker_our {
        background-color: map-get($conflict-colors, #{$theme}-header-head-neutral);
        border-color: map-get($conflict-colors, #{$theme}-header-head-neutral);
      }

      &.conflict_marker_their {
        background-color: map-get($conflict-colors, #{$theme}-header-origin-neutral);
        border-color: map-get($conflict-colors, #{$theme}-header-origin-neutral);
      }

      &.conflict_our {
        background-color: map-get($conflict-colors, #{$theme}-line-head-neutral);
        border-color: map-get($conflict-colors, #{$theme}-line-head-neutral);
      }

      &.conflict_their {
        background-color: map-get($conflict-colors, #{$theme}-line-origin-neutral);
        border-color: map-get($conflict-colors, #{$theme}-line-origin-neutral);
      }
    }
  }
}

@mixin line-number-link($color) {
  min-width: $gl-spacing-scale-9;

  &::before {
    @include gl-display-none;
    @include gl-align-self-center;
    @include gl-mt-2;
    @include gl-mr-2;
    @include gl-w-4;
    @include gl-h-4;
    @include gl-float-left;
    background-color: $color;
    mask-image: asset_url('icons-stacked.svg#link');
    mask-repeat: no-repeat;
    mask-size: cover;
    mask-position: center;
    content: '';
  }

  &:hover::before {
    @include gl-display-inline-block;
  }

  &:focus::before {
    @include gl-display-inline-block;
  }
}