Ghost/ghost/admin/assets/sass/components/splitbuttons.scss

257 lines
5.8 KiB
SCSS
Raw Normal View History

// ------------------------------------------------------------
// Splitbuttons
2014-08-04 20:28:07 +04:00
//
// Styles for splitbuttons (button + toggle for a popover)
//
// * Default
// * Base Placeholder Styles
// * Variation Classes
// ------------------------------------------------------------
//
// Default
2014-08-04 20:28:07 +04:00
// --------------------------------------------------
.splitbtn {
position: relative;
display: inline-block;
vertical-align: middle;
.btn {
position: relative;
float: left;
// Prevent double border between buttons
+ .btn {
margin-left: -1px;
}
// Make sure the hovered element is always on
// top so overlap from .btn + btn. invisible
&:hover,
&:focus,
&:active,
&.active {
z-index: 2;
}
}
// Flatten out the right side
.btn:first-child {
margin-left: 0;
&:not(:last-child):not(.dropdown-toggle) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
}
// Flatten out the left side
.dropdown-toggle {
padding-left: 12px;
padding-right: 12px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
&.btn-sm {
padding-left: 10px;
padding-right: 10px;
}
&.btn-lg {
padding-left: 16px;
padding-right: 16px;
}
// This is the additional dropdown arrow, to the right of the button.
.options {
text-align: center;
color: #fff;
@include icon($i-chevron-down, 9px) {
top: 0;
display: inline-block;
position: relative;
}
}
&.up .options:before {
transform: rotate(-360deg);
transition: transform 0.6s ease, top 0.6s ease;
}
&.up:hover .options:before,
&.up.open .options:before {
top: -1px;
transform: rotate(540deg);
transition: transform 0.3s ease, top 0.3s ease;
}
}
}//.splitbtn
//
// Base Placeholder Styles
// --------------------------------------------------
2014-08-04 20:28:07 +04:00
%splitbtn {
display: inline-block;
position: relative;
font-size: 0; // hack to stop space after button
white-space: nowrap;
button {
font-size: 11px; // hack to restore font size
border-top-right-radius: 0;
border-bottom-right-radius: 0;
2014-08-04 20:28:07 +04:00
}
// This is the additional dropdown arrow, to the right of the button.
.options {
display: inline-block;
position:relative;
width: 35px;
height: 35px;
margin-left: -1px;
vertical-align: top;
text-align: center;
color: #fff;
background: #e5e5e5;
border-radius: 0 2px 2px 0;
border-left: 0;
box-shadow:
rgba(0,0,0,0.02) 0 1px 0 inset,
rgba(0,0,0,0.02) -1px 0 0 inset,
rgba(0,0,0,0.02) 0 -1px 0 inset;
transition: background-color 0.3s linear;
2014-08-04 20:28:07 +04:00
@include icon($i-chevron-down, 9px) {
position: absolute;
top: 50%;
right: 50%;
margin-top: -3px;
margin-right: -5px;
transition: margin-top 0.3s ease;
transition-property: transform;
transition-duration: 0.3;
transition-timing-function: ease;
2014-08-04 20:28:07 +04:00
};
// Keep the arrow spun when the associated menu is open
&.active:before {
transform: rotate(360deg);
2014-08-04 20:28:07 +04:00
}
&.up.active:before {
margin-top:-4px;
transform: rotate(540deg);
2014-08-04 20:28:07 +04:00
}
// Spin the arrow on hover and while menu is open
&:hover,
&:focus {
will-change: box-shadow, background;
box-shadow: none;
background: #f8f8f8;
@include icon($i-chevron-down) {
will-change: transform;
transform: rotate(360deg);
2014-08-04 20:28:07 +04:00
};
}
// If it has a class of "up" spin it an extra 180degress to point up
&.up:hover,
&.up:focus {
@include icon($i-chevron-down) {
margin-top:-4px;
transform: rotate(540deg);
transition-property: transform;
transition-duration: 0.6;
transition-timing-function: ease;
2014-08-04 20:28:07 +04:00
};
}
}//.options
}//%splitbtn
2014-08-04 20:28:07 +04:00
//
// Variation Classes
2014-08-04 20:28:07 +04:00
// --------------------------------------------------
// The default splitbutton
.splitbutton {
@extend %splitbtn;
2014-08-04 20:28:07 +04:00
.options {
color:#777;
2014-08-04 20:28:07 +04:00
&:hover,
&:focus {
box-shadow:
rgba(0,0,0,0.07) 0 1px 0 inset,
rgba(0,0,0,0.07) -1px 0 0 inset,
rgba(0,0,0,0.07) 0 -1px 0 inset;
}
}
}
// For save/next/continue/confirm actions
.splitbutton-save {
@extend %splitbtn;
2014-08-04 20:28:07 +04:00
.options {
background: darken($blue, 5%);
2014-08-04 20:28:07 +04:00
&:hover,
&.active,
&:focus {
background: darken($blue, 10%);
}
}
}
// For actions which add something
.splitbutton-add {
@extend %splitbtn;
2014-08-04 20:28:07 +04:00
.options {
background: darken($green, 6%);
2014-08-04 20:28:07 +04:00
&:hover,
&:focus {
background: darken($green, 8%);
}
}
}
// For actions which delete something
.splitbutton-delete {
@extend %splitbtn;
2014-08-04 20:28:07 +04:00
.options {
background: darken($red, 6%);
2014-08-04 20:28:07 +04:00
&:hover,
&:focus {
background: darken($red, 10%);
}
}
}
// Alternative style with more visual attention,
2014-08-04 20:28:07 +04:00
// but no extra semantic meaning
.splitbutton-alt {
@extend %splitbtn;
2014-08-04 20:28:07 +04:00
.options {
background: lighten($darkgrey, 4%);
2014-08-04 20:28:07 +04:00
&:hover,
&:focus {
background: $darkgrey;
}
}
}