~bigbes/sr-ht-compare

ref: 4e7c6329e40c58e790e98774d456af93c2e56bc5 sr-ht-compare/scss/main.scss -rw-r--r-- 3.6 KiB
4e7c6329 — bigbes web: full-width split diff view with a rendered file tree 30 days ago
                                                                                
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
// compare.sr.ht stylesheet.
//
// Mirrors the SourceHut service pattern (see paste.sr.ht/scss/main.scss): pull
// in the shared `base` partial (Bootstrap 4 + the SourceHut chrome: contrast,
// variables, nav, events, highlight, dark) and then add only the styles unique
// to the compare/diff views.
//
// Build (dev): dart-sass with the core.sr.ht scss dir + a Bootstrap 4 scss dir
// on the load path; production uses `sassc -I /usr/share/sourcehut/scss`.

@import "base";

// Let the @pierre/trees sidebar (which styles itself with the CSS `light-dark()`
// function) and any other scheme-aware widget follow prefers-color-scheme.
:root {
  color-scheme: light dark;
}

// ---- Truncation / info banner --------------------------------------------

.compare-truncated {
  @extend .alert;
  background: lighten($warning, 30);
  border: 1px solid $warning;
  color: $gray-900;
  margin-bottom: 1rem;

  @media (prefers-color-scheme: dark) {
    background: darken($warning, 35);
    border-color: darken($warning, 20);
    color: $gray-100;
  }
}

// ---- Two-column app shell: tree sidebar + fluid diff column ---------------

#compare-app {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;

  @include media-breakpoint-down(sm) {
    flex-direction: column;
    gap: 0.5rem;
  }
}

#tree-root {
  flex: 0 0 220px;
  width: 220px;
  max-width: 220px;
  position: sticky;
  top: 0.5rem;
  max-height: calc(100vh - 1rem);
  overflow: auto;

  @include media-breakpoint-down(sm) {
    position: static;
    flex-basis: auto;
    width: 100%;
    max-width: 100%;
    max-height: 16rem;
  }
}

#diff-root {
  flex: 1 1 auto;
  // Allow the flex child to shrink so wide code can scroll instead of
  // forcing horizontal overflow on the whole page.
  min-width: 0;
}

// ---- Layout toggle -------------------------------------------------------

.diff-layout-toggle {
  display: inline-flex;
  gap: 0.25rem;
  margin-bottom: 0.5rem;

  button {
    @extend .btn;
    @extend .btn-default;

    &.active {
      background: darken($primary, 10);
      border-color: darken($primary, 40);
      color: $white;
    }
  }
}

// ---- Per-file diff sections ----------------------------------------------

.diff-file {
  border: 1px solid $gray-400;
  margin-bottom: 1rem;
  overflow: hidden;

  @media (prefers-color-scheme: dark) {
    border-color: $gray-700;
  }
}

.diff-file-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.25rem 0.75rem;
  background: $gray-200;
  border-bottom: 1px solid $gray-400;
  font-family: $font_family_monospace;
  font-size: 0.9rem;

  @media (prefers-color-scheme: dark) {
    background: lighten($gray-900, 5);
    border-bottom-color: $gray-700;
  }
}

.diff-file-path {
  overflow-wrap: anywhere;
  font-weight: bold;
}

.diff-file-arrow {
  color: $gray-600;
}

.diff-file-oldpath {
  color: $gray-600;
  text-decoration: line-through;
}

.diff-file-stats {
  display: inline-flex;
  gap: 0.5rem;
  white-space: nowrap;
  flex: 0 0 auto;
}

.diff-file-add {
  color: darken($success, 10);
  @media (prefers-color-scheme: dark) {
    color: lighten($success, 10);
  }
}

.diff-file-del {
  color: darken($danger, 5);
  @media (prefers-color-scheme: dark) {
    color: lighten($danger, 5);
  }
}

.diff-file-badge {
  padding: 0 0.25rem;
  border: 1px solid $gray-500;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: $gray-700;

  @media (prefers-color-scheme: dark) {
    color: $gray-300;
    border-color: $gray-600;
  }
}

.diff-file-body {
  overflow-x: auto;
}

.diff-file-note,
.diff-empty {
  padding: 0.5rem 0.75rem;
  color: $gray-600;
  font-style: italic;
}