0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00
ghost/core/client/assets/sass/components/dropdowns.scss

272 lines
5.5 KiB
SCSS
Raw Normal View History

// ------------------------------------------------------------
2014-08-05 18:07:45 +01:00
// Dropdown menus
//
// Styles for the dropdown component
//
// * Base Styles
// * States
// * Open & Close
// * Dropdown triangles placeholder styles
// * Dropdown triangles classes
// ------------------------------------------------------------
2014-07-29 11:00:29 +01:00
//
// Base Styles
// --------------------------------------------------
2014-08-05 18:07:45 +01:00
// The dropdown wrapper <div>
2014-08-05 18:07:45 +01:00
.dropdown {
position: relative;
}
// Prevent the focus on the dropdown toggle when closing dropdowns
.dropdown-toggle:focus {
outline: 0;
}
// The dropdown menu <ul>
2014-08-05 18:07:45 +01:00
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
2014-08-05 18:07:45 +01:00
float: left;
2014-09-24 14:03:19 +03:00
min-width: 220px;
2014-08-05 18:07:45 +01:00
padding: 5px 0;
margin: 2px 0 0; // override default ul
2014-08-05 18:07:45 +01:00
background-color: #fff;
2014-09-24 14:03:19 +03:00
border: darken($lightgrey, 15%) 1px solid;
border-radius: 2px;
2014-08-08 21:54:22 +01:00
box-shadow: rgba(0,0,0,0.175) 0 2px 6px;
2014-08-05 18:07:45 +01:00
background-clip: padding-box;
list-style: none;
font-size: 1.4rem;
font-weight: normal;
text-transform: none;
letter-spacing: 0;
text-align: left;
2014-08-05 18:07:45 +01:00
// Aligns the dropdown menu to right
&.pull-right {
right: 0;
left: auto;
}
// Dividers (basically an hr) within the dropdown
.divider {
height: 1px;
2014-09-24 14:03:19 +03:00
margin: 4px 0;
2014-08-05 18:07:45 +01:00
overflow: hidden;
2014-09-24 14:03:19 +03:00
background: darken($lightgrey, 5%);
2014-08-05 18:07:45 +01:00
}
// Links within the dropdown menu
2014-08-13 15:15:23 +01:00
> li > a,
> li > button {
2014-08-05 18:07:45 +01:00
display: block;
2014-08-13 15:15:23 +01:00
width: 100%;
2014-08-05 18:07:45 +01:00
padding: 3px 20px;
clear: both;
2014-08-05 18:07:45 +01:00
font-weight: normal;
2014-09-24 14:03:19 +03:00
line-height: 1.9em;
2014-08-13 15:15:23 +01:00
text-align: left;
2014-08-05 18:07:45 +01:00
color: #333;
white-space: nowrap;
transition: none;
2014-08-05 18:07:45 +01:00
}
2014-09-24 14:03:19 +03:00
i {
font-size: 0.9em;
margin-right: 0.5rem;
}
}//.dropdown-menu
//
// States
// --------------------------------------------------
2014-08-05 18:07:45 +01:00
// Hover/Focus state
2014-08-13 15:15:23 +01:00
.dropdown-menu > li > a,
.dropdown-menu > li > button {
2014-08-05 18:07:45 +01:00
&:hover,
&:focus {
text-decoration: none;
2014-08-08 21:54:22 +01:00
color: #fff;
background: $blue;
2014-08-05 18:07:45 +01:00
}
}
// Active state
2014-08-13 15:15:23 +01:00
.dropdown-menu > .active > a,
.dropdown-menu > .active > button {
2014-08-05 18:07:45 +01: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 15:15:23 +01:00
.dropdown-menu > .disabled > a,
.dropdown-menu > .disabled > button {
2014-08-05 18:07:45 +01:00
&,
&:hover,
&:focus {
color: #777;
}
}
2014-08-05 18:07:45 +01:00
// Nuke hover/focus effects
2014-08-13 15:15:23 +01:00
.dropdown-menu > .disabled > a,
.dropdown-menu > .disabled > button {
2014-08-05 18:07:45 +01:00
&:hover,
&:focus {
text-decoration: none;
background-color: transparent;
background-image: none; // Remove CSS gradient
cursor: not-allowed;
}
}
//
// Open & Close
// --------------------------------------------------
2014-08-05 18:07:45 +01:00
// Open state for the dropdown
.open {
2014-08-05 18:07:45 +01:00
// Show the menu
> .dropdown-menu {
display: block;
}
// Remove the outline when :focus is triggered
> a {
outline: 0;
}
}
// Closed state for the dropdown
.closed {
> .dropdown-menu {
display: none;
}
}
2014-08-05 18:07:45 +01:00
//
// Dropdown triangles placeholder styles
2014-08-05 18:07:45 +01:00
// --------------------------------------------------
%dropdown-triangle {
2014-07-29 12:46:19 +01:00
&:before {
content: '';
position: absolute;
display: block;
}//&:before
2014-07-29 11:00:29 +01:00
2014-07-29 12:46:19 +01:00
&:after {
content: '';
position: absolute;
z-index: -1;
}//&:after
2014-08-05 18:07:45 +01:00
}
2014-07-29 11:00:29 +01:00
2014-08-05 18:07:45 +01:00
%dropdown-triangle-top {
2014-07-29 12:46:19 +01:00
&:before {
2014-09-29 12:17:27 +01:00
@include triangle($dropdown_triangle, #fff, up);
2014-07-31 16:06:25 +01:00
top: -$dropdown_triangle;
2014-07-29 11:00:29 +01:00
}
2014-07-29 12:46:19 +01:00
&:after {
2014-09-29 12:17:27 +01:00
@include triangle($dropdown_triangle + 2, darken($lightgrey, 15%), up);
top: -($dropdown_triangle + 2);
2014-07-29 12:46:19 +01:00
}
2014-07-31 16:06:25 +01:00
}
2014-08-05 18:07:45 +01:00
%dropdown-triangle-bottom {
2014-07-29 12:46:19 +01:00
&:before {
2014-09-29 12:17:27 +01:00
@include triangle($dropdown_triangle, #fff, down);
2014-07-31 16:06:25 +01:00
bottom: -$dropdown_triangle;
2014-07-29 12:46:19 +01:00
}
&:after {
2014-09-29 12:17:27 +01:00
@include triangle($dropdown_triangle + 2, darken($lightgrey, 15%), down);
bottom: -($dropdown_triangle + 2);
2014-07-29 12:46:19 +01:00
}
2014-07-31 16:06:25 +01:00
}
2014-08-05 18:07:45 +01:00
%dropdown-triangle-center {
2014-07-31 16:06:25 +01:00
&:before {
left: 50%;
2014-09-29 12:17:27 +01:00
margin-left: -($dropdown_triangle / 2);
2014-07-31 16:06:25 +01:00
}
&:after {
left: 50%;
2014-09-29 12:17:27 +01:00
margin-left: -($dropdown_triangle / 2 + 2);
2014-07-31 16:06:25 +01:00
}
}
2014-08-05 18:07:45 +01:00
%dropdown-triangle-left {
2014-07-31 16:06:25 +01:00
&:before {
2014-09-29 12:17:27 +01:00
left: ($dropdown_triangle / 2 + 2);
2014-07-31 16:06:25 +01:00
}
&:after {
2014-09-29 12:17:27 +01:00
left: ($dropdown_triangle / 2);
2014-07-31 16:06:25 +01:00
}
}
2014-08-05 18:07:45 +01:00
%dropdown-triangle-right {
2014-07-31 16:06:25 +01:00
&:before {
left: auto;
2014-09-29 12:17:27 +01:00
right: ($dropdown_triangle / 2 + 2);
2014-07-31 16:06:25 +01:00
}
&:after {
left: auto;
2014-09-29 12:17:27 +01:00
right: ($dropdown_triangle / 2);
2014-07-31 16:06:25 +01:00
}
}
//
// Dropdown triangles classes
// --------------------------------------------------
2014-08-05 18:07:45 +01:00
.dropdown-triangle-top {
@extend %dropdown-triangle;
@extend %dropdown-triangle-top;
@extend %dropdown-triangle-center;
2014-07-31 16:06:25 +01:00
}
2014-08-05 18:07:45 +01:00
.dropdown-triangle-top-left {
@extend %dropdown-triangle;
@extend %dropdown-triangle-top;
@extend %dropdown-triangle-left;
2014-07-31 16:06:25 +01:00
}
2014-08-05 18:07:45 +01:00
.dropdown-triangle-top-right {
@extend %dropdown-triangle;
@extend %dropdown-triangle-top;
@extend %dropdown-triangle-right;
2014-07-31 16:06:25 +01:00
}
2014-08-05 18:07:45 +01:00
.dropdown-triangle-bottom {
@extend %dropdown-triangle;
@extend %dropdown-triangle-bottom;
@extend %dropdown-triangle-center;
2014-07-31 16:06:25 +01:00
}
2014-08-05 18:07:45 +01:00
.dropdown-triangle-bottom-left {
@extend %dropdown-triangle;
@extend %dropdown-triangle-bottom;
@extend %dropdown-triangle-left;
2014-07-31 16:06:25 +01:00
}
2014-08-05 18:07:45 +01:00
.dropdown-triangle-bottom-right {
@extend %dropdown-triangle;
@extend %dropdown-triangle-bottom;
@extend %dropdown-triangle-right;
}