superdesk/superdesk-client-core

View on GitHub
styles/sass/button-groups.scss

Summary

Maintainability
Test Coverage
// BUTTON GROUPS
// -------------


// Make the div behave like a button
.btn-group {
  position: relative;
  @include clearfix(); // clears the floated buttons
}

// Space out series of button groups
.btn-group + .btn-group {
  margin-inline-start: 5px;
}

// Optional: Group multiple button groups together for a toolbar
.btn-toolbar {
  margin-block-start: $baseLineHeight / 2;
  margin-block-end: $baseLineHeight / 2;
  .btn-group {
    display: inline-block;
  }
}

// Float them, remove border radius, then re-add to first and last elements
.btn-group .btn {
  position: relative;
  float: inline-start;
  margin-inline-start: -1px;
  @include border-radius(0);
}
// Set corners individual because sometimes a single button can be in a .btn-group and we need :first-child and :last-child to both match
.btn-group .btn:first-child {
  margin-inline-start: 0;
  @include border-radius(3px 0 0 3px);
}
.btn-group .btn:last-child,
.btn-group .dropdown__toggle {
  @include border-radius(0 3px 3px 0);
}

// Reset corners for large buttons
.btn-group .btn.large:first-child {
  margin-inline-start: 0;
  @include border-radius(6px 0 0 6px);
}
.btn-group .btn.large:last-child,
.btn-group .large.dropdown__toggle {
     @include border-radius(0 6px 6px 0);
}

// On hover/focus/active, bring the proper btn to front
.btn-group .btn:hover,
.btn-group .btn:focus,
.btn-group .btn:active,
.btn-group .btn.active {
  z-index: 2;
}

// On active and open, don't show outline
.btn-group .dropdown__toggle:active,
.btn-group.open .dropdown__toggle {
  outline: 0;
}

// Split button dropdowns
// ----------------------

// Give the line between buttons some depth
.btn-group .dropdown__toggle {
  padding-inline-start: 8px;
  padding-inline-end: 8px;
 // $shadow: inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
  //.box-shadow($shadow);
  *padding-block-start: 3px;
  *padding-block-end: 3px;
}
.btn-group .btn--mini.dropdown__toggle {
  padding-inline-start: 5px;
  padding-inline-end: 5px;
  *padding-block-start: 1px;
  *padding-block-end: 1px;
}
.btn-group .btn--small.dropdown__toggle {
  *padding-block-start: 4px;
  *padding-block-end: 4px;
}
.btn-group .btn--large.dropdown__toggle {
  padding-inline-start: 12px;
  padding-inline-end: 12px;
}

.btn-group.open {
  // IE7's z-index only goes to the nearest positioned ancestor, which would
  // make the menu appear below buttons that appeared later on the page
  *z-index: $zindexDropdown;

  // Reposition menu on open and round all corners
  .dropdown__menu {
    display: block;
    margin-block-start: 1px;
    @include border-radius(5px);
  }
}


// Account for other colors
.btn--primary,
.btn--danger,
.btn--success,
.btn--inverse {
  .caret {
    border-top-color: $white;
    border-bottom-color: $white;
    @include opacity(75);
  }
}


// Custom toolbar buttons
.subnav__button-stack--custom-buttons {
  min-width: 150px;
    .btn {
      min-width: 38px;
        &--custom {
            color: $white;
            white-space: nowrap;
            background-color: hsl(214, 13%, 40%);
            &:hover {
                text-decoration: none;
                color: $white;
                background-color: $btn-custom-hover;
            }
        }
        &--publish {
            background-color: $btn-publish;
            &:hover {
                background-color: $btn-publish-hover;
            }
        }
        &--publish-plus {
            background-color: $btn-publish-plus;
            &:hover {
                background-color: $btn-publish-plus-hover;
            }
        }
    }
}