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

Clement Ho's avatar
Clement Ho committed
5 6 7 8 9 10 11 12 13 14 15 16 17
$text-color: $gl-text-color;

$brand-primary: $gl-primary;
$brand-success: $gl-success;
$brand-info: $gl-info;
$brand-warning: $gl-warning;
$brand-danger: $gl-danger;

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

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

$padding-base-vertical: $gl-vert-padding;
$padding-base-horizontal: $gl-padding;
21 22 23 24 25 26

html {
  // Override default font size used in bs4
  font-size: 14px;
}

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

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

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

Clement Ho's avatar
Clement Ho committed
77 78 79 80 81 82
input[type="file"] {
  // Bootstrap 4 file input height is taller by default
  // which makes them look ugly
  line-height: 1;
}

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

88 89 90 91
a {
  color: $gl-link-color;
}

Annabel Dunstone Gray's avatar
Annabel Dunstone Gray committed
92 93 94 95
hr {
  overflow: hidden;
}

96
.form-group.row .col-form-label {
97
  padding-top: 0;
98 99
  // 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;
Clement Ho's avatar
Clement Ho committed
111
  color: $red-600;
112
  background-color: $red-100;
113
  border-radius: $border-radius-default;
Clement Ho's avatar
Clement Ho committed
114

115
  .code > & {
Clement Ho's avatar
Clement Ho committed
116 117 118
    background-color: inherit;
    padding: unset;
  }
Clement Ho's avatar
Clement Ho committed
119 120 121 122 123

  .build-trace & {
    background-color: inherit;
    padding: inherit;
  }
Clement Ho's avatar
Clement Ho committed
124 125
}

Clement Ho's avatar
Clement Ho committed
126 127 128 129 130
table {
  // Remove any table border lines
  border-spacing: 0;
}

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

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

Clement Ho's avatar
Clement Ho committed
145
    .d#{$infix}-table-header-group { display: table-header-group !important; }
146 147 148
  }
}

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

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

165 166 167
// Polyfill deprecated selectors

.hidden {
168 169
  display: none !important;
  visibility: hidden !important;
170
}
171

Clement Ho's avatar
Clement Ho committed
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
  }
Jose's avatar
Jose committed
236 237 238 239

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

.card {
243 244 245 246
  .card-title {
    margin-bottom: 0;
  }

247
  &.card-without-border {
248
    @extend .border-0;
249 250 251 252 253
  }

  &.card-without-margin {
    margin: 0;
  }
254 255 256 257

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

Clement Ho's avatar
Clement Ho committed
260 261 262 263 264 265 266
.card-header {
  h3.card-title,
  h4.card-title {
    margin-top: 0;
  }
}

Annabel Gray's avatar
Annabel Gray committed
267
.nav-tabs {
Clement Ho's avatar
Clement Ho committed
268 269 270
  // Override bootstrap's default border
  border-bottom: 0;

Annabel Gray's avatar
Annabel Gray committed
271
  .nav-link {
272 273 274
    border-top: 0;
    border-left: 0;
    border-right: 0;
Annabel Gray's avatar
Annabel Gray committed
275 276 277 278 279
  }

  .nav-item {
    margin-bottom: 0;
  }
Annabel Dunstone Gray's avatar
Annabel Dunstone Gray committed
280
}
Clement Ho's avatar
Clement Ho committed
281 282 283 284

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

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

306 307 308
.alert-danger {
  background-color: $red-500;
  border-color: $red-500;
309 310
}

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

318
  h4,
319
  a:not(.btn),
320
  .alert-link {
321 322 323
    color: $white-light;
  }
}
Paul Slaughter's avatar
Paul Slaughter committed
324 325 326 327

input[type=color].form-control {
  height: $input-height;
}
Jose's avatar
Jose committed
328 329 330 331 332 333 334 335

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

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

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