buttons.scss 9.08 KB
Newer Older
Felipe Artur's avatar
Felipe Artur committed
1 2 3
@mixin btn-comment-icon {
  border-radius: 50%;
  background: $white-light;
4
  padding: 1px;
Felipe Artur's avatar
Felipe Artur committed
5 6
  font-size: 12px;
  color: $blue-500;
7
  border: 1px solid $blue-500;
8 9
  width: 24px;
  height: 24px;
Felipe Artur's avatar
Felipe Artur committed
10 11 12 13 14 15 16 17 18 19 20 21 22

  &:hover,
  &.inverted {
    background: $blue-500;
    border-color: $blue-600;
    color: $white-light;
  }

  &:active {
    outline: 0;
  }
}

23
@mixin btn-default {
24
  border-radius: $border-radius-default;
25
  font-size: $gl-font-size;
26
  font-weight: $gl-font-weight-normal;
27
  padding: $gl-vert-padding $gl-btn-padding;
28

29
  &:focus,
Andrey's avatar
Andrey committed
30
  &:active {
Annabel Dunstone's avatar
Annabel Dunstone committed
31
    background-color: $btn-active-gray;
Clement Ho's avatar
Clement Ho committed
32
    box-shadow: $gl-btn-active-background;
Andrey's avatar
Andrey committed
33 34 35 36
  }
}

@mixin btn-middle {
37
  @include btn-default;
Andrey's avatar
Andrey committed
38 39
}

40
@mixin btn-outline($background, $text, $border, $hover-background, $hover-text, $hover-border, $active-background, $active-border, $active-text) {
41 42 43 44
  background-color: $background;
  color: $text;
  border-color: $border;

45 46 47 48
  &.btn-border-color {
    border-color: $border-color;
  }

49
  > .icon {
50 51 52
    color: $text;
  }

53 54 55
  &:hover,
  &:focus {
    background-color: $hover-background;
56
    border-color: $hover-border;
57
    color: $hover-text;
58

59
    > .icon {
60 61
      color: $hover-text;
    }
62 63
  }

64 65 66 67
  &:focus {
    box-shadow: 0 0 4px 1px $blue-300;
  }

68 69 70
  &:active {
    background-color: $active-background;
    border-color: $active-border;
71 72
    box-shadow: inset 0 2px 4px 0 rgba($black, 0.2);
    color: $active-text;
73

74
    > .icon {
75 76 77 78 79
      color: $active-text;
    }

    &:focus {
      box-shadow: inset 0 2px 4px 0 rgba($black, 0.2);
80
    }
81 82 83
  }
}

84 85 86 87
@mixin btn-color($light, $border-light, $normal, $border-normal, $dark, $border-dark, $color) {
  background-color: $light;
  border-color: $border-light;
  color: $color;
Andrey's avatar
Andrey committed
88

89
  &:hover,
90
  &:focus {
91 92 93
    background-color: $normal;
    border-color: $border-normal;
    color: $color;
94 95
  }

Annabel Dunstone's avatar
Annabel Dunstone committed
96 97
  &:active,
  &.active {
Clement Ho's avatar
Clement Ho committed
98
    box-shadow: $gl-btn-active-background;
99

100 101 102
    background-color: $dark;
    border-color: $border-dark;
    color: $color;
103 104
  }
}
Andrey's avatar
Andrey committed
105

106
@mixin btn-green {
107
  @include btn-color($green-500, $green-600, $green-600, $green-700, $green-700, $green-800, $white-light);
108 109
}

110
@mixin btn-blue {
111
  @include btn-color($blue-500, $blue-600, $blue-600, $blue-700, $blue-700, $blue-800, $white-light);
Andriy Dyadyura's avatar
Andriy Dyadyura committed
112 113
}

114
@mixin btn-orange {
115
  @include btn-color($orange-500, $orange-600, $orange-600, $orange-700, $orange-700, $orange-800, $white-light);
Andrey's avatar
Andrey committed
116 117
}

118
@mixin btn-red {
119
  @include btn-color($red-500, $red-600, $red-600, $red-700, $red-700, $red-800, $white-light);
120
}
121

122
@mixin btn-white {
123
  @include btn-color($white-light, $border-color, $white-normal, $border-white-normal, $white-dark, $border-gray-dark, $gl-text-color);
124 125
}

126 127 128 129 130 131 132 133 134 135 136 137 138
@mixin btn-with-margin {
  margin-left: $btn-side-margin;
  float: left;

  &.inline {
    float: none;
  }

  &.btn-sm {
    margin-left: $btn-sm-side-margin;
  }
}

Clement Ho's avatar
Clement Ho committed
139 140 141 142 143 144 145
@mixin btn-svg {
  height: $gl-padding;
  width: $gl-padding;
  top: 0;
  vertical-align: text-top;
}

146
.btn {
147
  @include btn-default;
148
  @include btn-white;
149

150
  color: $gl-text-color;
151
  white-space: nowrap;
152

153 154 155 156
  &:focus:active {
    outline: 0;
  }

157
  &.btn-sm {
158
    padding: 4px 10px;
159 160 161 162 163 164
    font-size: $gl-btn-small-font-size;
    line-height: $gl-btn-small-line-height;
  }

  &.btn-xs {
    padding: 2px $gl-btn-padding;
165 166
    font-size: $gl-btn-xs-font-size;
    line-height: $gl-btn-xs-line-height;
Andriy Dyadyura's avatar
Andriy Dyadyura committed
167
  }
168

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
169
  &.btn-success,
170
  &.btn-register {
171 172
    @include btn-green;
  }
173

174
  &.btn-inverted {
175
    &.btn-success {
176
      @include btn-outline($white-light, $green-600, $green-500, $green-100, $green-700, $green-500, $green-200, $green-600, $green-800);
177
    }
178

179 180
    &.btn-remove,
    &.btn-danger {
181
      @include btn-outline($white-light, $red-500, $red-500, $red-100, $red-700, $red-500, $red-200, $red-600, $red-800);
182
    }
183

Phil Hughes's avatar
Phil Hughes committed
184
    &.btn-warning {
185
      @include btn-outline($white-light, $orange-500, $orange-500, $orange-100, $orange-700, $orange-500, $orange-200, $orange-600, $orange-800);
Phil Hughes's avatar
Phil Hughes committed
186 187
    }

188 189
    &.btn-primary,
    &.btn-info {
190
      @include btn-outline($white-light, $blue-500, $blue-500, $blue-100, $blue-700, $blue-500, $blue-200, $blue-600, $blue-800);
191
    }
192 193
  }

194
  &.btn-info,
195
  &.btn-primary {
196 197 198 199 200 201 202
    @include btn-blue;
  }

  &.btn-warning {
    @include btn-orange;
  }

203 204
  &.btn-close,
  &.btn-close-color {
205
    @include btn-outline($white-light, $orange-600, $orange-500, $orange-100, $orange-700, $orange-500, $orange-200, $orange-600, $orange-800);
206 207
  }

208
  &.btn-spam {
209
    @include btn-outline($white-light, $red-500, $red-500, $red-100, $red-700, $red-500, $red-200, $red-600, $red-800);
210 211
  }

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
212 213 214 215
  &.btn-danger,
  &.btn-remove,
  &.btn-red {
    @include btn-red;
216 217 218 219 220 221
  }

  &.btn-cancel {
    float: right;
  }

222 223
  &.btn-reopen,
  .btn-reopen-color {
224
    /* should be same as parent class for now */
225 226 227
  }

  &.btn-grouped {
228
    @include btn-with-margin;
229
  }
230

samdbeckham's avatar
samdbeckham committed
231 232 233 234
  &.btn-icon {
    color: $gl-gray-700;
  }

235
  .fa-caret-down,
236
  .fa-chevron-down {
237 238
    margin-left: 5px;
  }
Annabel Dunstone's avatar
Annabel Dunstone committed
239

240 241 242 243 244 245
  &.dropdown-toggle {
    .fa-caret-down {
      margin-left: 3px;
    }
  }

Fatih Acet's avatar
Fatih Acet committed
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
  &.btn-text-field {
    width: 100%;
    text-align: left;
    padding: 6px 16px;
    border-color: $border-color;
    color: $gray-darkest;
    background-color: $gray-light;

    &:hover,
    &:active,
    &:focus {
      cursor: text;
      box-shadow: none;
      border-color: lighten($blue-300, 20%);
      color: $gray-darkest;
      background-color: $gray-light;
    }
  }

265 266 267 268 269 270 271 272 273 274
  &.dot-highlight::after {
    content: '';
    background-color: $blue-500;
    width: $gl-padding * 0.5;
    height: $gl-padding * 0.5;
    display: inline-block;
    border-radius: 50%;
    margin-left: 3px;
  }

Clement Ho's avatar
Clement Ho committed
275 276 277 278 279 280 281
  svg {
    height: 15px;
    width: 15px;
    position: relative;
    top: 2px;
  }

282 283
  svg,
  .fa {
284
    &:not(:last-child) {
285
      margin-right: 5px;
286
    }
287
  }
288 289
}

290 291 292
.btn-terminal {
  svg {
    height: 14px;
293
    width: $default-icon-size;
294 295 296
  }
}

Phil Hughes's avatar
Phil Hughes committed
297 298 299 300
.btn-lg {
  padding: 12px 20px;
}

Phil Hughes's avatar
Phil Hughes committed
301
.btn-transparent {
302
  color: $gl-text-color-secondary;
Phil Hughes's avatar
Phil Hughes committed
303 304 305 306 307 308 309 310 311 312 313
  background-color: transparent;
  border: 0;

  &:hover,
  &:active,
  &:focus {
    background-color: transparent;
    box-shadow: none;
  }
}

314 315 316 317
.btn-block {
  width: 100%;
  margin: 0;
  margin-bottom: 15px;
318

319 320 321 322 323
  &.btn {
    padding: 6px 0;
  }
}

Eric Eastwood's avatar
Eric Eastwood committed
324 325
.btn-align-content {
  display: flex;
326
  justify-content: center;
Eric Eastwood's avatar
Eric Eastwood committed
327 328 329
  align-items: center;
}

330 331
.btn-group {
  &.btn-grouped {
332
    @include btn-with-margin;
333 334 335
  }
}

336
.btn-clipboard {
337
  border: 0;
338
  padding: 0 5px;
339 340 341

  svg {
    top: auto;
342 343
    width: 16px;
    height: 16px;
344
  }
345 346
}

347 348
.input-group-prepend,
.input-group-append {
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366
  .btn {
    @include btn-middle;

    &:hover {
      outline: none;
    }

    &:active {
      outline: none;
    }

    &.btn-clipboard {
      padding-left: 15px;
      padding-right: 15px;
    }
  }

  .active {
Clement Ho's avatar
Clement Ho committed
367
    box-shadow: $gl-btn-active-background;
368

369
    border: 1px solid $border-gray-dark !important;
370
    background-color: $btn-active-gray-light !important;
371
  }
372
}
373 374 375 376 377 378 379 380 381 382

.btn-loading {
  &:not(.disabled) .fa {
    display: none;
  }

  .fa {
    margin-right: 5px;
  }
}
Annabel Dunstone's avatar
Annabel Dunstone committed
383

384 385
.btn-build {
  margin-left: 10px;
386

Annabel Dunstone's avatar
Annabel Dunstone committed
387
  i {
388
    color: $gl-text-color-secondary;
Annabel Dunstone's avatar
Annabel Dunstone committed
389
  }
390 391 392 393

  svg {
    fill: $gl-text-color-secondary;
  }
Annabel Dunstone's avatar
Annabel Dunstone committed
394
}
395 396

.clone-dropdown-btn a {
397
  color: $gl-gray-700;
398

399 400 401 402
  &:hover {
    text-decoration: none;
  }
}
403 404

.btn-static {
405 406
  background-color: $gray-light !important;
  border: 1px solid $border-gray-normal;
407
  cursor: default;
408

409
  &:active {
410
    box-shadow: inset 0 0 0 $white-light;
411 412
  }
}
413

414 415
.btn-inverted {
  &-secondary {
416
    @include btn-outline($white-light, $blue-500, $blue-500, $blue-100, $blue-700, $blue-500, $blue-200, $blue-600, $blue-800);
417
  }
418 419
}

Clement Ho's avatar
Clement Ho committed
420
@include media-breakpoint-down(xs) {
421 422 423 424
  .btn-wide-on-xs {
    width: 100%;
  }
}
Phil Hughes's avatar
Phil Hughes committed
425 426 427 428 429

.btn-blank {
  padding: 0;
  background: transparent;
  border: 0;
Clement Ho's avatar
Clement Ho committed
430
  border-radius: 0;
Phil Hughes's avatar
Phil Hughes committed
431

Luke "Jared" Bennett's avatar
Luke "Jared" Bennett committed
432 433
  &:hover,
  &:active,
Phil Hughes's avatar
Phil Hughes committed
434 435
  &:focus {
    outline: 0;
Luke "Jared" Bennett's avatar
Luke "Jared" Bennett committed
436 437
    background: transparent;
    box-shadow: none;
Phil Hughes's avatar
Phil Hughes committed
438 439
  }
}
Clement Ho's avatar
Clement Ho committed
440

441
.btn-link {
Luke Bennett's avatar
Luke Bennett committed
442 443 444 445 446 447
  padding: 0;
  background-color: transparent;
  color: $blue-600;
  font-weight: normal;
  border-radius: 0;
  border-color: transparent;
Clement Ho's avatar
Clement Ho committed
448 449 450 451

  &:hover,
  &:active,
  &:focus {
Luke Bennett's avatar
Luke Bennett committed
452 453 454 455
    color: $blue-800;
    text-decoration: underline;
    background-color: transparent;
    border-color: transparent;
Clement Ho's avatar
Clement Ho committed
456 457
  }

458 459
  &.btn-secondary-hover-link,
  &.btn-default-hover-link {
Luke Bennett's avatar
Luke Bennett committed
460
    color: $gl-text-color-secondary;
Clement Ho's avatar
Clement Ho committed
461

Luke Bennett's avatar
Luke Bennett committed
462 463 464
    &:hover,
    &:active,
    &:focus {
465
      color: $blue-600;
Luke Bennett's avatar
Luke Bennett committed
466 467
      text-decoration: none;
    }
Luke Bennett's avatar
Luke Bennett committed
468 469
  }

Luke Bennett's avatar
Luke Bennett committed
470 471
  &.btn-primary-hover-link {
    color: inherit;
Luke Bennett's avatar
Luke Bennett committed
472

Luke Bennett's avatar
Luke Bennett committed
473 474 475
    &:hover,
    &:active,
    &:focus {
476
      color: $blue-600;
Luke Bennett's avatar
Luke Bennett committed
477 478
      text-decoration: none;
    }
Clement Ho's avatar
Clement Ho committed
479 480
  }
}
Clement Ho's avatar
Clement Ho committed
481

482
.btn-missing {
483
  color: $gl-text-color-secondary;
484 485 486 487 488 489
  border: 1px dashed $border-gray-normal-dashed;
  border-radius: $border-radius-default;

  &:hover,
  &:active,
  &:focus {
490
    color: $gl-text-color-secondary;
491 492 493 494
    background-color: $white-normal;
  }
}

Clement Ho's avatar
Clement Ho committed
495 496 497
.btn-svg svg {
  @include btn-svg;
}
498

499 500 501
// All disabled buttons, regardless of color, type, etc
%disabled {
  background-color: $gray-light !important;
502
  border-color: $gray-200 !important;
503 504
  color: $gl-text-color-disabled !important;
  opacity: 1 !important;
505
  cursor: default !important;
506 507 508 509 510 511

  i {
    color: $gl-text-color-disabled !important;
  }
}

512 513 514 515 516
.btn.disabled,
.btn[disabled],
fieldset[disabled] .btn,
.dropdown-toggle[disabled],
[disabled].dropdown-menu-toggle {
517
  @extend %disabled;
518

519 520
  &:hover {
    @extend %disabled;
521 522
  }
}
523

524 525 526 527
[readonly] {
  cursor: default;
}

528 529
.btn-no-padding {
  padding: 0;
530
}