mirror of
https://github.com/mdbootstrap/mdb-ui-kit.git
synced 2024-11-29 04:54:12 +03:00
148 lines
3.3 KiB
SCSS
148 lines
3.3 KiB
SCSS
// Menus https://www.google.com/design/spec/components/menus.html#menus-specs
|
|
// Dropdown buttons (mobile and desktop) https://www.google.com/design/spec/components/buttons.html#buttons-dropdown-buttons
|
|
|
|
.dropdown-menu {
|
|
display: none;
|
|
padding: .25rem 0;
|
|
border: 0;
|
|
opacity: 0;
|
|
transform: scale(0);
|
|
transform-origin: 0 0;
|
|
will-change: transform, opacity;
|
|
transition: transform $bmd-menu-expand-duration $bmd-animation-curve-default,
|
|
opacity $bmd-menu-fade-duration $bmd-animation-curve-default;
|
|
|
|
@include media-breakpoint-up(md) {
|
|
padding: .5rem 0;
|
|
}
|
|
|
|
&.showing {
|
|
animation-name: bmd-dropdown-animation;
|
|
animation-duration: $bmd-menu-expand-duration;
|
|
animation-fill-mode: forwards;
|
|
animation-timing-function: $bmd-animation-curve-default;
|
|
}
|
|
|
|
.open > &,
|
|
&.show {
|
|
display: block;
|
|
opacity: 1;
|
|
transform: scale(1);
|
|
}
|
|
|
|
&.hiding {
|
|
display: block;
|
|
opacity: 0;
|
|
transform: scale(0);
|
|
}
|
|
|
|
&[x-placement="bottom-start"],
|
|
&.dropdown-menu-left {
|
|
transform-origin: 0 0;
|
|
}
|
|
|
|
&[x-placement="bottom-end"],
|
|
&.dropdown-menu-right {
|
|
transform-origin: 100% 0;
|
|
}
|
|
|
|
&[x-placement="top-start"] {
|
|
transform-origin: 0 100%;
|
|
}
|
|
|
|
&[x-placement="top-end"] {
|
|
transform-origin: 100% 100%;
|
|
}
|
|
|
|
// https://www.google.com/design/spec/components/menus.html#menus-specs
|
|
.dropdown-item {
|
|
// used to properly size the ripple container
|
|
position: relative;
|
|
|
|
display: flex;
|
|
flex-flow: row wrap;
|
|
align-items: center;
|
|
|
|
min-width: $bmd-menu-item-min-width;
|
|
max-width: $bmd-menu-item-max-width;
|
|
min-height: $bmd-menu-item-min-height;
|
|
|
|
padding: $bmd-menu-item-padding-top $bmd-menu-item-padding-right
|
|
$bmd-menu-item-padding-bottom $bmd-menu-item-padding-left;
|
|
|
|
// FIXME: multi-line menu word wrapping doesn't work - see the maximum width example in menus.md
|
|
overflow: hidden;
|
|
line-height: $bmd-menu-line-height;
|
|
text-overflow: ellipsis;
|
|
word-wrap: break-word;
|
|
|
|
&.active,
|
|
&:active {
|
|
background-color: inherit;
|
|
color: inherit;
|
|
}
|
|
|
|
// Simple menus always maintain a 16dp margin (phone) or 24dp margin (tablet) to the left and right edges of the screen.
|
|
@include media-breakpoint-up(md) {
|
|
padding-right: $bmd-menu-item-padding-right-md;
|
|
padding-left: $bmd-menu-item-padding-left-md;
|
|
}
|
|
}
|
|
}
|
|
|
|
// this could be in a .btn-group or .dropdown
|
|
.dropdown-toggle {
|
|
&.bmd-btn-icon,
|
|
&.bmd-btn-fab {
|
|
// remove the dropdown icon
|
|
&::after {
|
|
display: none;
|
|
}
|
|
|
|
~ .dropdown-menu {
|
|
&.dropdown-menu-top-left,
|
|
&.dropdown-menu-top-right {
|
|
bottom: $bmd-btn-icon-size; // push up the bottom of the menu the height of the button
|
|
}
|
|
}
|
|
}
|
|
|
|
&.bmd-btn-fab-sm {
|
|
~ .dropdown-menu {
|
|
&.dropdown-menu-top-left,
|
|
&.dropdown-menu-top-right {
|
|
bottom: $bmd-btn-fab-size-sm; // push up the bottom of the menu the height of the button
|
|
}
|
|
}
|
|
}
|
|
|
|
&.bmd-btn-icon {
|
|
~ .dropdown-menu {
|
|
// collapse some spacing
|
|
margin: 0;
|
|
}
|
|
}
|
|
|
|
.show &.btn {
|
|
&,
|
|
&-secondary,
|
|
&-success,
|
|
&-info,
|
|
&-warning,
|
|
&-danger {
|
|
background-color: transparent;
|
|
}
|
|
}
|
|
}
|
|
|
|
@keyframes bmd-dropdown-animation {
|
|
from {
|
|
opacity: 0;
|
|
transform: scale(0);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: scale(1);
|
|
}
|
|
}
|