bootstrap_migration.scss 5.7 KB
Newer Older
1 2 3 4
/*
 *  Scss to help with bootstrap 3 to 4 migration
 */

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;
12 13 14 15 16

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

$modal-body-bg: $white-light;
$input-border: $border-color;
Clement Ho's avatar
Clement Ho committed
17 18 19

$padding-base-vertical: $gl-vert-padding;
$padding-base-horizontal: $gl-padding;
20

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

Clement Ho's avatar
Clement Ho committed
28 29 30 31 32
legend {
  border-bottom: 1px solid $border-color;
  margin-bottom: 20px;
}

Clement Ho's avatar
Clement Ho committed
33 34 35
button,
html [type="button"],
[type="reset"],
36 37
[type="submit"],
[role="button"] {
38 39 40 41 42
  // Override bootstrap reboot
  -webkit-appearance: inherit;
  cursor: pointer;
}

Clement Ho's avatar
Clement Ho committed
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
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;
}

73 74 75 76 77 78 79 80 81 82 83
/* Our adjustments to hx & .hx above add unnecessary margins to modal-title
   and page-title in modals, so we set them to 0 in order to have properly
   formatted modal headers. */
.modal-header {
  .modal-title,
  .page-title {
    margin-top: 0;
    margin-bottom: 0;
  }
}

Clement Ho's avatar
Clement Ho committed
84 85 86 87 88
h5,
.h5 {
  font-size: $gl-font-size;
}

Clement Ho's avatar
Clement Ho committed
89 90 91 92 93 94
input[type="file"] {
  // Bootstrap 4 file input height is taller by default
  // which makes them look ugly
  line-height: 1;
}

95 96 97 98 99
b,
strong {
  font-weight: bold;
}

100
a {
101
  color: $blue-600;
102 103
}

104 105 106 107
hr {
  overflow: hidden;
}

108 109 110
.form-group.row .col-form-label {
  // Bootstrap 4 aligns labels to the left
  // for horizontal forms
111 112 113
  @include media-breakpoint-up(md) {
    text-align: right;
  }
114 115
}

116 117 118 119
kbd {
  display: inline-block;
}

120 121
code {
  padding: 2px 4px;
122
  color: $red-600;
123
  background-color: $red-100;
124
  border-radius: $border-radius-default;
125

126
  .code > & {
127 128 129
    background-color: inherit;
    padding: unset;
  }
130 131 132 133 134

  .build-trace & {
    background-color: inherit;
    padding: inherit;
  }
135 136
}

Clement Ho's avatar
Clement Ho committed
137 138 139 140 141
table {
  // Remove any table border lines
  border-spacing: 0;
}

142 143
.tooltip,
.no-pointer-events {
Clement Ho's avatar
Clement Ho committed
144 145 146 147
  // Fix bootstrap4 bug whereby tooltips flicker when they are hovered over their borders
  pointer-events: none;
}

148 149
.popover,
.popover-header {
Clement Ho's avatar
Clement Ho committed
150 151
  font-size: 14px;
}
152 153 154 155 156

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

157 158 159
    .d#{$infix}-table-header-group {
      display: table-header-group !important;
    }
160 161 162
  }
}

163 164 165 166 167
.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;
}
168

Clement Ho's avatar
Clement Ho committed
169 170 171 172 173 174 175 176 177 178
.bg-success,
.bg-primary,
.bg-info,
.bg-danger,
.bg-warning {
  .card-header {
    color: $white-light;
  }
}

179 180 181
// Polyfill deprecated selectors

.hidden {
182 183
  display: none !important;
  visibility: hidden !important;
184
}
185

Clement Ho's avatar
Clement Ho committed
186 187 188 189
.hide {
  display: none;
}

190 191
.dropdown-toggle::after,
.dropright .dropdown-menu-toggle::after {
192 193 194
  // Remove bootstrap's dropdown caret
  display: none;
}
195

196 197 198 199 200 201
h3.popover-header {
  // Default bootstrap popovers use <h3>
  // which we default to having a top margin
  margin-top: 0;
}

202 203 204 205
// Add to .label so that old system notes that are saved to the db
// will still receive the correct styling
.badge,
.label {
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
  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;
  }
}
222 223 224 225

.divider {
  @extend .dropdown-divider;
}
226 227

.info-well {
228
  background: $gray-50;
229 230 231 232 233 234 235 236 237 238 239
  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;
    }
240 241 242 243 244 245 246 247 248

    p,
    ol,
    ul,
    .form-group {
      &:last-of-type {
        margin-bottom: 0;
      }
    }
249
  }
250 251 252 253

  .badge.badge-gray {
    background-color: $well-expand-item;
  }
254
}
255 256 257

.card {
  &.card-without-border {
258
    @extend .border-0;
259 260 261 262 263
  }

  &.card-without-margin {
    margin: 0;
  }
264 265 266 267

  &.bg-light {
    @extend .border-0;
  }
268
}
Annabel Dunstone Gray's avatar
Annabel Dunstone Gray committed
269

270
.nav-tabs {
Clement Ho's avatar
Clement Ho committed
271 272 273
  // Override bootstrap's default border
  border-bottom: 0;

274
  .nav-link {
275 276 277
    border-top: 0;
    border-left: 0;
    border-right: 0;
278 279 280 281 282
  }

  .nav-item {
    margin-bottom: 0;
  }
Annabel Dunstone Gray's avatar
Annabel Dunstone Gray committed
283
}
Clement Ho's avatar
Clement Ho committed
284 285 286 287

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

Clement Ho's avatar
Clement Ho committed
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308
.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;
}

309 310 311
.alert-danger {
  background-color: $red-500;
  border-color: $red-500;
312 313
}

Clement Ho's avatar
Clement Ho committed
314 315
.alert-success,
.alert-info,
316 317 318
.alert-warning,
.alert-danger,
.flash-notice {
319 320
  color: $white-light;

321
  h4,
322
  a:not(.btn),
323
  .alert-link {
324 325 326
    color: $white-light;
  }
}
327 328 329 330

input[type=color].form-control {
  height: $input-height;
}
331 332 333 334 335 336 337 338

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

340 341 342 343
.project-templates-buttons {
  .btn {
    vertical-align: unset;
  }
344
}
345 346 347 348 349 350 351 352 353 354

// 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;
}
355 356 357 358 359 360 361 362 363

/*
 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;
}