grafana/public/sass/components/_dropdown.scss

335 lines
6.7 KiB
SCSS
Raw Normal View History

2016-02-15 08:27:41 -06:00
//
// Dropdown menus
// --------------------------------------------------
// Use the .menu class on any <li> element within the topbar or ul.tabs and you'll get some superfancy dropdowns
.dropup,
.dropdown {
position: relative;
}
2016-11-28 08:38:55 -06:00
2016-02-15 08:27:41 -06:00
.dropdown-toggle:active,
.open .dropdown-toggle {
outline: 0;
}
.dropdown-desc {
position: relative;
top: -3px;
width: 250px;
font-size: $font-size-sm;
margin-left: 22px;
color: $gray-2;
white-space: normal;
}
2016-02-15 08:27:41 -06:00
// Dropdown arrow/caret
// --------------------
.caret {
display: inline-block;
width: 0;
height: 0;
vertical-align: top;
2017-12-19 09:22:41 -06:00
border-top: 4px solid $text-color-weak;
2016-02-15 08:27:41 -06:00
border-right: 4px solid transparent;
2017-12-19 09:22:41 -06:00
border-left: 4px solid transparent;
content: '';
2016-02-15 08:27:41 -06:00
}
// Place the caret
.dropdown .caret {
margin-top: 8px;
margin-left: 2px;
}
// The dropdown menu (ul)
// ----------------------
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
2016-02-16 07:39:45 -06:00
z-index: $zindex-dropdown;
2016-02-15 08:27:41 -06:00
display: none; // none by default, but block on "open" of the menu
float: left;
min-width: 140px;
margin: 2px 0 0; // override default ul
list-style: none;
background-color: $dropdownBackground;
border: 1px solid $dropdownBorder;
text-align: left;
2016-02-15 08:27:41 -06:00
// Aligns the dropdown menu to right
&.pull-left {
2016-02-15 08:27:41 -06:00
right: 0;
left: auto;
}
2016-02-15 10:14:02 -06:00
.divider {
2019-03-21 04:43:06 -05:00
height: 1px;
margin: $space-sm 0; // 8px 1px
2016-02-15 10:14:02 -06:00
overflow: hidden;
background-color: $dropdownDividerTop;
border-bottom: 1px solid $dropdownDividerBottom;
}
2016-02-15 08:27:41 -06:00
// Links within the dropdown menu
2016-04-22 05:09:02 -05:00
> li {
> a {
2016-04-22 05:09:02 -05:00
display: block;
padding: 3px 20px 3px 15px;
clear: both;
font-weight: normal;
line-height: $line-height-base;
color: $dropdownLinkColor;
white-space: nowrap;
2016-02-15 08:27:41 -06:00
2016-04-22 05:09:02 -05:00
i {
display: inline-block;
margin-right: 10px;
2016-04-22 05:09:02 -05:00
color: $link-color-disabled;
position: relative;
top: 3px;
2017-10-14 14:17:16 -05:00
}
.gicon {
opacity: 0.7;
width: 18px;
height: 14px;
2016-04-22 05:09:02 -05:00
}
2016-02-15 08:27:41 -06:00
}
}
2017-06-12 09:46:02 -05:00
&--navbar {
top: 100%;
min-width: 100%;
}
&--menu,
2017-06-12 09:46:02 -05:00
&--navbar,
&--sidemenu {
background: $menu-dropdown-bg;
2017-06-12 14:11:22 -05:00
box-shadow: $menu-dropdown-shadow;
2017-06-12 09:46:02 -05:00
margin-top: 0px;
> li > a {
display: flex;
padding: 5px 10px;
2017-06-12 09:46:02 -05:00
border-left: 2px solid transparent;
&:hover {
@include left-brand-border-gradient();
color: $link-hover-color;
2017-06-12 14:11:22 -05:00
background: $menu-dropdown-hover-bg !important;
2017-06-12 09:46:02 -05:00
}
}
}
&--sidemenu {
li.sidemenu-org-switcher {
> a {
padding: 8px 10px 8px 15px;
}
}
}
2016-02-15 08:27:41 -06:00
}
.dropdown-item-text {
flex-grow: 1;
2016-02-15 08:27:41 -06:00
}
// Hover/Focus state
// -----------
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus,
.dropdown-submenu:hover > a,
.dropdown-submenu:focus > a {
text-decoration: none;
color: $dropdownLinkColorHover;
2016-02-19 05:26:39 -06:00
background-color: $dropdownLinkBackgroundHover;
2016-02-15 08:27:41 -06:00
}
// Active state
// ------------
.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus {
color: $dropdownLinkColorActive;
text-decoration: none;
outline: 0;
2016-02-19 05:26:39 -06:00
background-color: $dropdownLinkBackgroundHover;
2016-02-15 08:27:41 -06:00
}
// Disabled state
// --------------
// Gray out text and ensure the hover/focus state remains gray
.dropdown-menu > .disabled > a,
.dropdown-menu > .disabled > a:hover,
.dropdown-menu > .disabled > a:focus {
2016-02-19 05:26:39 -06:00
color: $gray-2;
2016-02-15 08:27:41 -06:00
}
// Nuke hover/focus effects
.dropdown-menu > .disabled > a:hover,
.dropdown-menu > .disabled > a:focus {
text-decoration: none;
background-color: transparent;
background-image: none; // Remove CSS gradient
cursor: default;
}
// Open state for the dropdown
// ---------------------------
.open {
& > .dropdown-menu {
display: block;
}
& > .dropdown > .dropdown-menu {
// Panel menu. TODO: See if we can merge this with above
display: block;
}
&.cascade-open {
.dropdown-menu {
display: block;
}
}
2016-02-15 08:27:41 -06:00
}
// Backdrop to catch body clicks on mobile, etc.
// ---------------------------
.dropdown-backdrop {
position: fixed;
left: 0;
right: 0;
bottom: 0;
top: 0;
2016-02-16 07:39:45 -06:00
z-index: $zindex-dropdown - 10;
2016-02-15 08:27:41 -06: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 $black;
content: '';
2016-02-15 08:27:41 -06:00
}
// Different positioning for bottom up menu
.dropdown-menu {
top: auto;
2017-08-15 07:49:12 -05:00
bottom: 0;
2016-02-15 08:27:41 -06:00
margin-bottom: 1px;
}
}
// Sub menus
// ---------------------------
.dropdown-submenu {
position: relative;
}
2016-02-15 08:27:41 -06:00
// Default dropdowns
.dropdown-submenu > .dropdown-menu {
top: 0;
left: 100%;
2017-04-11 03:05:30 -05:00
margin-top: 0px;
2016-02-15 08:27:41 -06:00
margin-left: -1px;
@include border-radius(0 6px 6px 6px);
}
.dropdown-submenu:hover > .dropdown-menu {
display: block;
}
// Dropups
.dropup .dropdown-submenu > .dropdown-menu {
top: auto;
bottom: 0;
margin-top: 0;
margin-bottom: -2px;
@include border-radius(5px 5px 5px 0);
}
@grafana/ui: Create Icon component and replace part of the icons (#23402) * Part1: Unicons implementation (#23197) * Create a new Icon component * Update icons in main sidebar * Update icons in Useful links and in react components on main site * Update icons in Useful links and in main top navigation * Adjust sizing * Update panel navigation and timepicker * Update icons in Panel menu * NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179) * Update icons in add panel widget * Resolve merge conflict * Fix part of the test errors and type errors * Fix storybook errors * Update getAvailableIcons import in storybook knobs * Fix import path * Fix SyntaxError: Cannot use import statement outside a module in test environment error * Remove dynamic imports * Remove types as using @ts-ignore * Update snapshot test * Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax * Remove color prop from icon, remove color implemetation in mono icons * Update navbar styling * Move toPascalCase to utils/string Co-authored-by: Torkel Ödegaard <torkel@grafana.com> * Resolve type errors resulted from merge * Part2: Unicons implementation (#23266) * Create a new Icon component * Update icons in main sidebar * Update icons in Useful links and in react components on main site * Update icons in Useful links and in main top navigation * Adjust sizing * Update panel navigation and timepicker * Update icons in Panel menu * Update icons in add panel widget * Resolve merge conflict * Fix part of the test errors and type errors * Fix storybook errors * Update getAvailableIcons import in storybook knobs * Fix import path * Fix SyntaxError: Cannot use import statement outside a module in test environment error * Remove dynamic imports * Remove types as using @ts-ignore * Update snapshot test * Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax * Implment icons in Tabs * Implement icons in search items and empty list * Update buttons * Update button-related snapshot tests * Update icons in modals and page headers * Create anfular wrapper and update all icons on search screen * Update sizing, remove colors, update snapshot tests * Remove color prop from icon, remove color implemetation in mono icons * Remove color props from monochrome icons * Complete update of icons for search screen * Update icons for infor tooltips, playlist, permissions * Support temporarly font awesome icons used in enterprise grafana * Part1: Unicons implementation (#23197) * Create a new Icon component * Update icons in main sidebar * Update icons in Useful links and in react components on main site * Update icons in Useful links and in main top navigation * Adjust sizing * Update panel navigation and timepicker * Update icons in Panel menu * NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179) * Update icons in add panel widget * Resolve merge conflict * Fix part of the test errors and type errors * Fix storybook errors * Update getAvailableIcons import in storybook knobs * Fix import path * Fix SyntaxError: Cannot use import statement outside a module in test environment error * Remove dynamic imports * Remove types as using @ts-ignore * Update snapshot test * Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax * Remove color prop from icon, remove color implemetation in mono icons * Update navbar styling * Move toPascalCase to utils/string Co-authored-by: Torkel Ödegaard <torkel@grafana.com> * Icons update * Add optional chaining to for isFontAwesome variable Co-authored-by: Torkel Ödegaard <torkel@grafana.com> * Part3: Unicons implementation (#23356) * Create a new Icon component * Update icons in main sidebar * Update icons in Useful links and in react components on main site * Update icons in Useful links and in main top navigation * Adjust sizing * Update panel navigation and timepicker * Update icons in Panel menu * Update icons in add panel widget * Resolve merge conflict * Fix part of the test errors and type errors * Fix storybook errors * Update getAvailableIcons import in storybook knobs * Fix import path * Fix SyntaxError: Cannot use import statement outside a module in test environment error * Remove dynamic imports * Remove types as using @ts-ignore * Update snapshot test * Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax * Implment icons in Tabs * Implement icons in search items and empty list * Update buttons * Update button-related snapshot tests * Update icons in modals and page headers * Create anfular wrapper and update all icons on search screen * Update sizing, remove colors, update snapshot tests * Remove color prop from icon, remove color implemetation in mono icons * Remove color props from monochrome icons * Complete update of icons for search screen * Update icons for infor tooltips, playlist, permissions * Support temporarly font awesome icons used in enterprise grafana * Part1: Unicons implementation (#23197) * Create a new Icon component * Update icons in main sidebar * Update icons in Useful links and in react components on main site * Update icons in Useful links and in main top navigation * Adjust sizing * Update panel navigation and timepicker * Update icons in Panel menu * NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179) * Update icons in add panel widget * Resolve merge conflict * Fix part of the test errors and type errors * Fix storybook errors * Update getAvailableIcons import in storybook knobs * Fix import path * Fix SyntaxError: Cannot use import statement outside a module in test environment error * Remove dynamic imports * Remove types as using @ts-ignore * Update snapshot test * Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax * Remove color prop from icon, remove color implemetation in mono icons * Update navbar styling * Move toPascalCase to utils/string Co-authored-by: Torkel Ödegaard <torkel@grafana.com> * Update icons in Explore * Update icons in alerting * Update + and x buttons * Update icons in configurations and settings * Update close icons * Update icons in rich history * Update alert messages * Add optional chaining to for isFontAwesome variable * Remove icon mock, set up jest.config * Fix navbar plus icon * Fir enable-bacground to enableBackgournd Co-authored-by: Torkel Ödegaard <torkel@grafana.com> * Merge remote branch origin master to icons-unicons * Revert "Merge remote branch origin master to icons-unicons" This reverts commit 3f25d50a39a940883fefe73ce51219139c1ed37f. * Size-up dashnav icons * Fix alerting icons, panel headers, update tests * Fix typecheck error * Adjustments - add panel icon, spacing * Set TerserPlugin sourceMap to false to prevent running out of memory when publishing storybook Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2020-04-08 07:33:31 -05:00
// .dropdown-submenu > a::after {
// position: absolute;
// top: 35%;
// right: $space-sm;
// background-color: transparent;
// color: $text-color-weak;
// font: normal normal normal $font-size-sm/1 FontAwesome;
// content: '\f0da';
// pointer-events: none;
// font-size: 11px;
// }
.dropdown-submenu:hover > a::after {
2016-02-15 08:27:41 -06:00
border-left-color: $dropdownLinkColorHover;
}
// Left aligned submenus
.dropdown-submenu.pull-left {
// Undo the float
// Yes, this is awkward since .pull-left adds a float, but it sticks to our conventions elsewhere.
float: none !important;
2016-02-15 08:27:41 -06:00
// Positioning the submenu
> .dropdown-menu {
left: -100%;
width: 100%;
margin-left: 2px;
2016-02-15 08:27:41 -06:00
@include border-radius(6px 0 6px 6px);
}
}
.dropdown-submenu.pull-right {
float: none !important;
}
2016-02-15 08:27:41 -06:00
// Tweak nav headers
// -----------------
// Increase padding from 15px to 20px on sides
.dropdown .dropdown-menu .nav-header {
padding-left: 20px;
padding-right: 20px;
}
// Typeahead
// ---------
.typeahead {
z-index: $zindex-typeahead;
2016-02-15 08:27:41 -06:00
}
.dropdown-menu-item-shortcut {
display: block;
margin-left: $spacer;
color: $text-muted;
min-width: 47px;
}
2017-06-20 13:45:00 -05:00
.dropdown-menu.dropdown-menu--new {
li a {
padding: $spacer/2 $spacer;
border-left: 2px solid $side-menu-bg;
background: $side-menu-bg;
i {
display: inline-block;
padding-right: 21px;
}
&:hover {
@include left-brand-border-gradient();
color: $link-hover-color;
background: $input-label-bg;
}
}
}