bulma/sass/components/menu.scss
2024-09-18 23:53:25 +01:00

157 lines
5.1 KiB
SCSS

@use "../utilities/css-variables" as cv;
@use "../utilities/initial-variables" as iv;
@use "../utilities/extends";
@use "../utilities/mixins" as mx;
$menu-item-background-color: cv.getVar("scheme-main") !default;
$menu-item-color: cv.getVar("text") !default;
$menu-item-hover-background-color: hsl(
from #{cv.getVar("menu-item-background-color")} h s calc(l + #{cv.getVar(
"hover-background-l-delta"
)})
) !default;
$menu-item-hover-color: cv.getVar("text-strong") !default;
$menu-item-active-background-color: hsl(
from #{cv.getVar("menu-item-background-color")} h s calc(l + #{cv.getVar(
"active-background-l-delta"
)})
) !default;
$menu-item-active-color: cv.getVar("text-strong") !default;
$menu-item-selected-background-color: cv.getVar("link") !default;
$menu-item-selected-color: cv.getVar("link-invert") !default;
$menu-item-selected-hover-background-color: hsl(
from #{cv.getVar("menu-item-selected-background-color")} h s calc(l + #{cv.getVar(
"hover-background-l-delta"
)})
) !default;
$menu-item-selected-active-background-color: hsl(
from #{cv.getVar("menu-item-selected-background-color")} h s calc(l + #{cv.getVar(
"active-background-l-delta"
)})
) !default;
$menu-item-radius: cv.getVar("radius-small") !default;
$menu-list-border-left: 1px solid cv.getVar("border") !default;
$menu-list-line-height: 1.25 !default;
$menu-list-link-padding: 0.5em 0.75em !default;
$menu-nested-list-margin: 0.75em !default;
$menu-nested-list-padding-left: 0.75em !default;
$menu-label-color: cv.getVar("text-weak") !default;
$menu-label-font-size: 0.75em !default;
$menu-label-letter-spacing: 0.1em !default;
$menu-label-spacing: 1em !default;
.#{iv.$class-prefix}menu {
@include cv.register-vars(
(
"menu-item-background-color": #{$menu-item-background-color},
"menu-item-color": #{$menu-item-color},
"menu-item-hover-background-color": #{$menu-item-hover-background-color},
"menu-item-hover-color": #{$menu-item-hover-color},
"menu-item-active-background-color": #{$menu-item-active-background-color},
"menu-item-active-color": #{$menu-item-active-color},
"menu-item-selected-background-color": #{$menu-item-selected-background-color},
"menu-item-selected-color": #{$menu-item-selected-color},
"menu-item-selected-hover-background-color": #{$menu-item-selected-hover-background-color},
"menu-item-selected-active-background-color": #{$menu-item-selected-active-background-color},
"menu-item-radius": #{$menu-item-radius},
"menu-list-border-left": #{$menu-list-border-left},
"menu-list-line-height": #{$menu-list-line-height},
"menu-list-link-padding": #{$menu-list-link-padding},
"menu-nested-list-margin": #{$menu-nested-list-margin},
"menu-nested-list-padding-left": #{$menu-nested-list-padding-left},
"menu-label-color": #{$menu-label-color},
"menu-label-font-size": #{$menu-label-font-size},
"menu-label-letter-spacing": #{$menu-label-letter-spacing},
"menu-label-spacing": #{$menu-label-spacing},
)
);
}
.#{iv.$class-prefix}menu {
font-size: cv.getVar("size-normal");
// Sizes
&.#{iv.$class-prefix}is-small {
font-size: cv.getVar("size-small");
}
&.#{iv.$class-prefix}is-medium {
font-size: cv.getVar("size-medium");
}
&.#{iv.$class-prefix}is-large {
font-size: cv.getVar("size-large");
}
}
.#{iv.$class-prefix}menu-list {
line-height: cv.getVar("menu-list-line-height");
a,
button,
.#{iv.$class-prefix}menu-item {
@extend %reset;
background-color: cv.getVar("menu-item-background-color");
border-radius: cv.getVar("menu-item-radius");
color: cv.getVar("menu-item-color");
display: block;
padding: cv.getVar("menu-list-link-padding");
text-align: left;
width: 100%;
&:hover {
background-color: cv.getVar("menu-item-hover-background-color");
color: cv.getVar("menu-item-hover-color");
}
&:active {
background-color: cv.getVar("menu-item-active-background-color");
color: cv.getVar("menu-item-active-color");
}
// Modifiers
&.#{iv.$class-prefix}is-active,
&.#{iv.$class-prefix}is-selected {
background-color: cv.getVar("menu-item-selected-background-color");
color: cv.getVar("menu-item-selected-color");
&:hover {
background-color: cv.getVar(
"menu-item-selected-hover-background-color"
);
}
&:active {
background-color: cv.getVar(
"menu-item-selected-active-background-color"
);
}
}
}
li {
ul {
border-inline-start: cv.getVar("menu-list-border-left");
margin: cv.getVar("menu-nested-list-margin");
padding-inline-start: cv.getVar("menu-nested-list-padding-left");
}
}
}
.#{iv.$class-prefix}menu-label {
color: cv.getVar("menu-label-color");
font-size: cv.getVar("menu-label-font-size");
letter-spacing: cv.getVar("menu-label-letter-spacing");
text-transform: uppercase;
&:not(:first-child) {
margin-top: cv.getVar("menu-label-spacing");
}
&:not(:last-child) {
margin-bottom: cv.getVar("menu-label-spacing");
}
}