bootstrap_migration.scss 5.4 KB
Newer Older
C
Clement Ho 已提交
1 2 3 4
/*
 *  Scss to help with bootstrap 3 to 4 migration
 */

C
Clement Ho 已提交
5 6
$text-color: $gl-text-color;

7 8 9 10 11
$brand-primary: $blue-500;
$brand-success: $green-500;
$brand-info: $blue-500;
$brand-warning: $orange-500;
$brand-danger: $red-500;
C
Clement Ho 已提交
12 13 14 15 16

$border-radius-base: 3px !default;

$modal-body-bg: $white-light;
$input-border: $border-color;
C
Clement Ho 已提交
17 18 19

$padding-base-vertical: $gl-vert-padding;
$padding-base-horizontal: $gl-padding;
C
Clement Ho 已提交
20

C
Clement Ho 已提交
21 22 23 24
body,
.form-control,
.search form {
  // Override default font size used in non-csslab UI
C
Clement Ho 已提交
25 26 27
  font-size: 14px;
}

C
Clement Ho 已提交
28 29 30 31 32
legend {
  border-bottom: 1px solid $border-color;
  margin-bottom: 20px;
}

C
Clement Ho 已提交
33 34 35
button,
html [type="button"],
[type="reset"],
J
Jose 已提交
36 37
[type="submit"],
[role="button"] {
38 39 40 41 42
  // Override bootstrap reboot
  -webkit-appearance: inherit;
  cursor: pointer;
}

C
Clement Ho 已提交
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
h1,
h2,
h3,
h4,
h5,
h6 {
  color: $gl-text-color;
  font-weight: 600;
}

h1,
.h1,
h2,
.h2,
h3,
.h3 {
  margin-top: 20px;
  margin-bottom: 10px;
}

h4,
.h4,
h5,
.h5,
h6,
.h6 {
  margin-top: 10px;
  margin-bottom: 10px;
}

h5,
.h5 {
  font-size: $gl-font-size;
}

C
Clement Ho 已提交
78 79 80 81 82 83
input[type="file"] {
  // Bootstrap 4 file input height is taller by default
  // which makes them look ugly
  line-height: 1;
}

84 85 86 87 88
b,
strong {
  font-weight: bold;
}

89
a {
A
Annabel Gray 已提交
90
  color: $blue-600;
91 92
}

A
Annabel Dunstone Gray 已提交
93 94 95 96
hr {
  overflow: hidden;
}

97 98 99
.form-group.row .col-form-label {
  // Bootstrap 4 aligns labels to the left
  // for horizontal forms
100 101 102
  @include media-breakpoint-up(md) {
    text-align: right;
  }
103 104
}

105 106 107 108
kbd {
  display: inline-block;
}

109 110
code {
  padding: 2px 4px;
C
Clement Ho 已提交
111
  color: $red-600;
112
  background-color: $red-100;
113
  border-radius: $border-radius-default;
C
Clement Ho 已提交
114

115
  .code > & {
C
Clement Ho 已提交
116 117 118
    background-color: inherit;
    padding: unset;
  }
C
Clement Ho 已提交
119 120 121 122 123

  .build-trace & {
    background-color: inherit;
    padding: inherit;
  }
C
Clement Ho 已提交
124 125
}

C
Clement Ho 已提交
126 127 128 129 130
table {
  // Remove any table border lines
  border-spacing: 0;
}

131 132
.tooltip,
.no-pointer-events {
C
Clement Ho 已提交
133 134 135 136
  // Fix bootstrap4 bug whereby tooltips flicker when they are hovered over their borders
  pointer-events: none;
}

C
Clement Ho 已提交
137 138 139
.popover {
  font-size: 14px;
}
140 141 142 143 144

@each $breakpoint in map-keys($grid-breakpoints) {
  @include media-breakpoint-up($breakpoint) {
    $infix: breakpoint-infix($breakpoint, $grid-breakpoints);

C
Clement Ho 已提交
145
    .d#{$infix}-table-header-group { display: table-header-group !important; }
146 147 148
  }
}

C
Clement Ho 已提交
149 150 151 152 153
.text-secondary {
  // Override Bootstrap's light secondary color
  // We have to use !important because bootstrap has that set as well
  color: $gl-text-color-secondary !important;
}
154

C
Clement Ho 已提交
155 156 157 158 159 160 161 162 163 164
.bg-success,
.bg-primary,
.bg-info,
.bg-danger,
.bg-warning {
  .card-header {
    color: $white-light;
  }
}

C
Clement Ho 已提交
165 166 167
// Polyfill deprecated selectors

.hidden {
168 169
  display: none !important;
  visibility: hidden !important;
C
Clement Ho 已提交
170
}
171

C
Clement Ho 已提交
172 173 174 175
.hide {
  display: none;
}

176 177
.dropdown-toggle::after,
.dropright .dropdown-menu-toggle::after {
178 179 180
  // Remove bootstrap's dropdown caret
  display: none;
}
181

182 183 184 185 186 187
h3.popover-header {
  // Default bootstrap popovers use <h3>
  // which we default to having a top margin
  margin-top: 0;
}

188 189 190 191
// Add to .label so that old system notes that are saved to the db
// will still receive the correct styling
.badge,
.label {
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
  padding: 4px 5px;
  font-size: 12px;
  font-style: normal;
  font-weight: $gl-font-weight-normal;
  display: inline-block;

  &.badge-gray {
    background-color: $label-gray-bg;
    color: $gl-text-color;
    text-shadow: none;
  }

  &.badge-inverse {
    background-color: $label-inverse-bg;
  }
}
208 209 210 211

.divider {
  @extend .dropdown-divider;
}
212 213 214 215 216 217 218 219 220 221 222 223 224 225

.info-well {
  background: $theme-gray-50;
  color: $gl-text-color;
  border: 1px solid $border-color;
  border-radius: 4px;
  margin-bottom: 16px;

  .well-segment {
    padding: 16px;

    &:not(:last-of-type) {
      border-bottom: 1px solid $well-inner-border;
    }
226 227 228 229 230 231 232 233 234

    p,
    ol,
    ul,
    .form-group {
      &:last-of-type {
        margin-bottom: 0;
      }
    }
235
  }
J
Jose 已提交
236 237 238 239

  .badge.badge-gray {
    background-color: $well-expand-item;
  }
240
}
241 242 243

.card {
  &.card-without-border {
244
    @extend .border-0;
245 246 247 248 249
  }

  &.card-without-margin {
    margin: 0;
  }
250 251 252 253

  &.bg-light {
    @extend .border-0;
  }
254
}
A
Annabel Dunstone Gray 已提交
255

A
Annabel Gray 已提交
256
.nav-tabs {
C
Clement Ho 已提交
257 258 259
  // Override bootstrap's default border
  border-bottom: 0;

A
Annabel Gray 已提交
260
  .nav-link {
261 262 263
    border-top: 0;
    border-left: 0;
    border-right: 0;
A
Annabel Gray 已提交
264 265 266 267 268
  }

  .nav-item {
    margin-bottom: 0;
  }
A
Annabel Dunstone Gray 已提交
269
}
C
Clement Ho 已提交
270 271 272 273

pre code {
  white-space: pre-wrap;
}
274

C
Clement Ho 已提交
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294
.alert,
.flash-notice {
  border-radius: 0;
}

.alert-success {
  background-color: $green-500;
  border-color: $green-500;
}

.alert-info {
  background-color: $blue-500;
  border-color: $blue-500;
}

.alert-warning {
  background-color: $orange-500;
  border-color: $orange-500;
}

295 296 297
.alert-danger {
  background-color: $red-500;
  border-color: $red-500;
298 299
}

C
Clement Ho 已提交
300 301
.alert-success,
.alert-info,
302 303 304
.alert-warning,
.alert-danger,
.flash-notice {
305 306
  color: $white-light;

307
  h4,
308
  a:not(.btn),
309
  .alert-link {
310 311 312
    color: $white-light;
  }
}
P
Paul Slaughter 已提交
313 314 315 316

input[type=color].form-control {
  height: $input-height;
}
J
Jose 已提交
317 318 319 320 321 322 323 324

.toggle-sidebar-button {
  .collapse-text,
  .icon-angle-double-left,
  .icon-angle-double-right {
    color: $gl-text-color-secondary;
  }
}
325

326 327 328 329
.project-templates-buttons {
  .btn {
    vertical-align: unset;
  }
330
}
331 332 333 334 335 336 337 338 339 340

// Bootstrap 3 compatibility because bootstrap_form Gem is not updated yet
.input-group-btn:first-child {
  @extend .input-group-prepend;
}

// Bootstrap 3 compatibility because bootstrap_form Gem is not updated yet
.input-group-btn:last-child {
  @extend .input-group-append;
}
L
Lukas Eipert 已提交
341 342 343 344 345 346 347 348 349

/*
 Bootstrap 4.1.2 introduced a new default vertical alignment which breaks our icons,
 so we need to reset the vertical alignment to the default value. See:
 - https://gitlab.com/gitlab-org/gitlab-ce/issues/51362
 */
svg {
  vertical-align: baseline;
}