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

334 lines
7.3 KiB
SCSS
Raw Normal View History

2014-07-29 14:00:29 +04:00
//
2014-08-05 21:07:45 +04:00
// Dropdown menus
2014-07-29 14:00:29 +04:00
// --------------------------------------------------
2014-08-05 21:07:45 +04:00
// Dropdown arrow/caret
.caret {
2014-07-29 14:00:29 +04:00
display: inline-block;
2014-08-05 21:07:45 +04:00
width: 0;
height: 0;
margin-left: 2px;
vertical-align: middle;
border-top: 4px solid;
border-right: 4px solid transparent;
border-left: 4px solid transparent;
}
// The dropdown wrapper (div)
.dropdown {
position: relative;
}
// Prevent the focus on the dropdown toggle when closing dropdowns
.dropdown-toggle:focus {
outline: 0;
}
// The dropdown menu (ul)
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none; // none by default, but block on "open" of the menu
float: left;
2014-09-24 15:03:19 +04:00
min-width: 220px;
2014-08-05 21:07:45 +04:00
padding: 5px 0;
margin: 2px 0 0; // override default ul
list-style: none;
2014-08-09 00:54:22 +04:00
font-size: 1.4rem;
font-weight: normal;
text-transform: none;
letter-spacing: 0;
2014-08-05 21:07:45 +04:00
text-align: left; // Ensures proper alignment if parent has it changed (e.g., modal footer)
background-color: #fff;
2014-09-24 15:03:19 +04:00
border: darken($lightgrey, 15%) 1px solid;
border-radius: 2px;
2014-08-09 00:54:22 +04:00
box-shadow: rgba(0,0,0,0.175) 0 2px 6px;
2014-08-05 21:07:45 +04:00
background-clip: padding-box;
// Aligns the dropdown menu to right
//
// Deprecated as of 3.1.0 in favor of `.dropdown-menu-[dir]`
&.pull-right {
right: 0;
left: auto;
}
// Dividers (basically an hr) within the dropdown
.divider {
height: 1px;
2014-09-24 15:03:19 +04:00
margin: 4px 0;
2014-08-05 21:07:45 +04:00
overflow: hidden;
2014-09-24 15:03:19 +04:00
background: darken($lightgrey, 5%);
2014-08-05 21:07:45 +04:00
}
// Links within the dropdown menu
2014-08-13 18:15:23 +04:00
> li > a,
> li > button {
2014-08-05 21:07:45 +04:00
display: block;
2014-08-13 18:15:23 +04:00
width: 100%;
2014-08-05 21:07:45 +04:00
padding: 3px 20px;
clear: both;
font-weight: normal;
2014-09-24 15:03:19 +04:00
line-height: 1.9em;
2014-08-13 18:15:23 +04:00
text-align: left;
2014-08-05 21:07:45 +04:00
color: #333;
white-space: nowrap; // prevent links from randomly breaking onto new lines
}
2014-09-24 15:03:19 +04:00
i {
font-size: 0.9em;
margin-right: 0.5rem;
}
2014-08-05 21:07:45 +04:00
}
// Hover/Focus state
2014-08-13 18:15:23 +04:00
.dropdown-menu > li > a,
.dropdown-menu > li > button {
2014-08-05 21:07:45 +04:00
&:hover,
&:focus {
text-decoration: none;
2014-08-09 00:54:22 +04:00
color: #fff;
background: $blue;
2014-08-05 21:07:45 +04:00
}
}
// Active state
2014-08-13 18:15:23 +04:00
.dropdown-menu > .active > a,
.dropdown-menu > .active > button {
2014-08-05 21:07:45 +04:00
&,
&:hover,
&:focus {
color: #fff;
text-decoration: none;
outline: 0;
background-color: #428bca;
}
}
// Disabled state
//
// Gray out text and ensure the hover/focus state remains gray
2014-08-13 18:15:23 +04:00
.dropdown-menu > .disabled > a,
.dropdown-menu > .disabled > button {
2014-08-05 21:07:45 +04:00
&,
&:hover,
&:focus {
color: #777;
}
}
// Nuke hover/focus effects
2014-08-13 18:15:23 +04:00
.dropdown-menu > .disabled > a,
.dropdown-menu > .disabled > button {
2014-08-05 21:07:45 +04:00
&:hover,
&:focus {
text-decoration: none;
background-color: transparent;
background-image: none; // Remove CSS gradient
cursor: not-allowed;
}
}
// Open state for the dropdown
.open {
// Show the menu
> .dropdown-menu {
display: block;
}
// Remove the outline when :focus is triggered
> a {
outline: 0;
}
}
// Menu positioning
//
// Add extra class to `.dropdown-menu` to flip the alignment of the dropdown
// menu with the parent.
.dropdown-menu-right {
left: auto; // Reset the default from `.dropdown-menu`
right: 0;
}
// With v3, we enabled auto-flipping if you have a dropdown within a right
// aligned nav component. To enable the undoing of that, we provide an override
// to restore the default dropdown menu alignment.
//
// This is only for left-aligning a dropdown menu within a `.navbar-right` or
// `.pull-right` nav component.
.dropdown-menu-left {
left: 0;
right: auto;
}
// Dropdown section headers
.dropdown-header {
display: block;
padding: 3px 20px;
2014-08-09 00:54:22 +04:00
font-size: 1.2rem;
2014-08-05 21:07:45 +04:00
line-height: 1.428571429;
color: #777;
white-space: nowrap; // as with > li > a
}
// Backdrop to catch body clicks on mobile, etc.
.dropdown-backdrop {
position: fixed;
left: 0;
right: 0;
bottom: 0;
top: 0;
2014-08-09 00:54:22 +04:00
z-index: 990;
2014-08-05 21:07:45 +04:00
}
// Right aligned dropdowns
.pull-right > .dropdown-menu {
right: 0;
left: auto;
}
// Allow for dropdowns to go bottom up (aka, dropup-menu)
//
// Just add .dropup after the standard .dropdown class and you're set, bro.
// TODO: abstract this so that the navbar fixed styles are not placed here?
.dropup,
.navbar-fixed-bottom .dropdown {
// Reverse the caret
.caret {
border-top: 0;
border-bottom: 4px solid;
content: "";
}
// Different positioning for bottom up menu
.dropdown-menu {
top: auto;
bottom: 100%;
margin-bottom: 1px;
}
}
// Component alignment
//
// Reiterate per navbar.less and the modified component alignment there.
@media (min-width: 768px) {
.navbar-right {
.dropdown-menu {
right: 0; left: auto;
}
// Necessary for overrides of the default right aligned menu.
// Will remove come v4 in all likelihood.
.dropdown-menu-left {
left: 0; right: auto;
}
2014-07-29 14:00:29 +04:00
}
2014-08-05 21:07:45 +04:00
}
2014-07-29 14:00:29 +04:00
2014-08-05 21:07:45 +04:00
//
// Dropdown triangles
// --------------------------------------------------
// Placeholders
%dropdown-triangle {
2014-07-29 15:46:19 +04:00
&:before {
content: '';
position: absolute;
display: block;
} // :before
2014-07-29 14:00:29 +04:00
2014-07-29 15:46:19 +04:00
&:after {
content: '';
position: absolute;
z-index: -1;
} // :after
2014-08-05 21:07:45 +04:00
}
2014-07-29 14:00:29 +04:00
2014-08-05 21:07:45 +04:00
%dropdown-triangle-top {
2014-07-29 15:46:19 +04:00
&:before {
2014-08-05 21:07:45 +04:00
@include triangle(($dropdown_triangle * 2), #fff, up);
2014-07-31 19:06:25 +04:00
top: -$dropdown_triangle;
2014-07-29 14:00:29 +04:00
}
2014-07-29 15:46:19 +04:00
&:after {
2014-09-24 15:03:19 +04:00
@include triangle(($dropdown_triangle * 2) + 2, darken($lightgrey, 15%), up);
2014-08-05 21:07:45 +04:00
top: -($dropdown_triangle + 1);
2014-07-29 15:46:19 +04:00
}
2014-07-31 19:06:25 +04:00
}
2014-08-05 21:07:45 +04:00
%dropdown-triangle-bottom {
2014-07-29 15:46:19 +04:00
&:before {
2014-08-05 21:07:45 +04:00
@include triangle(($dropdown_triangle * 2), #fff, down);
2014-07-31 19:06:25 +04:00
bottom: -$dropdown_triangle;
2014-07-29 15:46:19 +04:00
}
&:after {
2014-09-24 15:03:19 +04:00
@include triangle(($dropdown_triangle * 2) + 2, darken($lightgrey, 15%), down);
2014-08-05 21:07:45 +04:00
bottom: -($dropdown_triangle + 1);
2014-07-29 15:46:19 +04:00
}
2014-07-31 19:06:25 +04:00
}
2014-08-05 21:07:45 +04:00
%dropdown-triangle-center {
2014-07-31 19:06:25 +04:00
&:before {
left: 50%;
2014-08-05 21:07:45 +04:00
margin-left: (-$dropdown_triangle);
2014-07-31 19:06:25 +04:00
}
&:after {
left: 50%;
2014-08-05 21:07:45 +04:00
margin-left: -($dropdown_triangle + 1);
2014-07-31 19:06:25 +04:00
}
}
2014-08-05 21:07:45 +04:00
2014-07-31 19:06:25 +04:00
// TODO: Make the values here use the $dropdown_triangle var
2014-08-05 21:07:45 +04:00
%dropdown-triangle-left {
2014-07-31 19:06:25 +04:00
&:before {
2014-08-05 21:07:45 +04:00
left: ($dropdown_triangle + 2);
2014-07-31 19:06:25 +04:00
}
&:after {
2014-08-05 21:07:45 +04:00
left: ($dropdown_triangle + 1);
2014-07-31 19:06:25 +04:00
}
}
2014-08-05 21:07:45 +04:00
%dropdown-triangle-right {
2014-07-31 19:06:25 +04:00
&:before {
left: auto;
2014-08-05 21:07:45 +04:00
right: ($dropdown_triangle + 2);
2014-07-31 19:06:25 +04:00
}
&:after {
left: auto;
2014-08-05 21:07:45 +04:00
right: ($dropdown_triangle + 1);
2014-07-31 19:06:25 +04:00
}
}
2014-08-05 21:07:45 +04:00
// Usable classes
.dropdown-triangle-top {
@extend %dropdown-triangle;
@extend %dropdown-triangle-top;
@extend %dropdown-triangle-center;
2014-07-31 19:06:25 +04:00
}
2014-08-05 21:07:45 +04:00
.dropdown-triangle-top-left {
@extend %dropdown-triangle;
@extend %dropdown-triangle-top;
@extend %dropdown-triangle-left;
2014-07-31 19:06:25 +04:00
}
2014-08-05 21:07:45 +04:00
.dropdown-triangle-top-right {
@extend %dropdown-triangle;
@extend %dropdown-triangle-top;
@extend %dropdown-triangle-right;
2014-07-31 19:06:25 +04:00
}
2014-08-05 21:07:45 +04:00
.dropdown-triangle-bottom {
@extend %dropdown-triangle;
@extend %dropdown-triangle-bottom;
@extend %dropdown-triangle-center;
2014-07-31 19:06:25 +04:00
}
2014-08-05 21:07:45 +04:00
.dropdown-triangle-bottom-left {
@extend %dropdown-triangle;
@extend %dropdown-triangle-bottom;
@extend %dropdown-triangle-left;
2014-07-31 19:06:25 +04:00
}
2014-08-05 21:07:45 +04:00
.dropdown-triangle-bottom-right {
@extend %dropdown-triangle;
@extend %dropdown-triangle-bottom;
@extend %dropdown-triangle-right;
2014-09-24 15:03:19 +04:00
}