/
githubmirror
/
tabler
Обзор
Документация
Войти
/
githubmirror
/
tabler
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
core/scss/bootstrap/_navbar.scss
290 строк
8 KB
Bartosz-Do
Move `--tblr-` custom-property prefixing from Sass to PostCSS (#2795)
06 авг 2026, 00:48
Не верифицирован
06 авг 2026, 00:48
cad8eb8
Код
Авторство
О чём код?
@use 'sass:map'; // Navbar // // Provide a static navbar from which we expand to create full-width, fixed, and // other navbar variations. @use '../config' as *; .navbar { // scss-docs-start navbar-css-vars --navbar-padding-x: #{if(sass($navbar-padding-x == null): 0; else: $navbar-padding-x)}; --navbar-padding-y: #{$navbar-padding-y}; --navbar-color: #{$navbar-light-color}; --navbar-hover-color: #{$navbar-light-hover-color}; --navbar-disabled-color: #{$navbar-light-disabled-color}; --navbar-active-color: #{$navbar-light-active-color}; --navbar-brand-padding-y: #{$navbar-brand-padding-y}; --navbar-brand-margin-end: #{$navbar-brand-margin-end}; --navbar-brand-font-size: #{$navbar-brand-font-size}; --navbar-brand-color: #{$navbar-light-brand-color}; --navbar-brand-hover-color: #{$navbar-light-brand-hover-color}; --navbar-nav-link-padding-x: #{$navbar-nav-link-padding-x}; --navbar-toggler-padding-y: #{$navbar-toggler-padding-y}; --navbar-toggler-padding-x: #{$navbar-toggler-padding-x}; --navbar-toggler-font-size: #{$navbar-toggler-font-size}; --navbar-toggler-icon-bg: #{escape-svg($navbar-light-toggler-icon-bg)}; --navbar-toggler-border-color: #{$navbar-light-toggler-border-color}; --navbar-toggler-border-radius: #{$navbar-toggler-border-radius}; --navbar-toggler-focus-width: #{$navbar-toggler-focus-width}; --navbar-toggler-transition: #{$navbar-toggler-transition}; // scss-docs-end navbar-css-vars position: relative; display: flex; flex-wrap: wrap; // allow us to do the line break for collapsing content align-items: center; justify-content: space-between; // space out brand from logo padding: var(--navbar-padding-y) var(--navbar-padding-x); @include gradient-bg(); // Because flex properties aren't inherited, we need to redeclare these first // few properties so that content nested within behave properly. // The `flex-wrap` property is inherited to simplify the expanded navbars %container-flex-properties { display: flex; flex-wrap: inherit; align-items: center; justify-content: space-between; } > .container, > .container-fluid { @extend %container-flex-properties; } @each $breakpoint, $container-max-width in $container-max-widths { > .container#{breakpoint-infix($breakpoint, $container-max-widths)} { @extend %container-flex-properties; } } } // Navbar brand // // Used for brand, project, or site names. .navbar-brand { padding-top: var(--navbar-brand-padding-y); padding-bottom: var(--navbar-brand-padding-y); margin-inline-end: var(--navbar-brand-margin-end); @include font-size(var(--navbar-brand-font-size)); color: var(--navbar-brand-color); text-decoration: if(sass($link-decoration == none): null; else: none); white-space: nowrap; &:hover, &:focus { color: var(--navbar-brand-hover-color); text-decoration: if(sass($link-hover-decoration == underline): none; else: null); } } // Navbar nav // // Custom navbar navigation (doesn't require `.nav`, but does make use of `.nav-link`). .navbar-nav { // scss-docs-start navbar-nav-css-vars --nav-link-padding-x: 0; --nav-link-padding-y: #{$nav-link-padding-y}; @include rfs($nav-link-font-size, --nav-link-font-size); --nav-link-font-weight: #{$nav-link-font-weight}; --nav-link-color: var(--navbar-color); --nav-link-hover-color: var(--navbar-hover-color); --nav-link-disabled-color: var(--navbar-disabled-color); // scss-docs-end navbar-nav-css-vars display: flex; flex-direction: column; // cannot use `inherit` to get the `.navbar`s value padding-inline-start: 0; margin-bottom: 0; list-style: none; .nav-link { &.active, &.show { color: var(--navbar-active-color); } } .dropdown-menu { position: static; } } // Navbar text // // .navbar-text { padding-top: $nav-link-padding-y; padding-bottom: $nav-link-padding-y; color: var(--navbar-color); a, a:hover, a:focus { color: var(--navbar-active-color); } } // Responsive navbar // // Custom styles for responsive collapsing and toggling of navbar contents. // Powered by the collapse Bootstrap JavaScript plugin. // When collapsed, prevent the toggleable navbar contents from appearing in // the default flexbox row orientation. Requires the use of `flex-wrap: wrap` // on the `.navbar` parent. .navbar-collapse { flex-grow: 1; flex-basis: 100%; // For always expanded or extra full navbars, ensure content aligns itself // properly vertically. Can be easily overridden with flex utilities. align-items: center; } // Button for toggling the navbar when in its collapsed state .navbar-toggler { padding: var(--navbar-toggler-padding-y) var(--navbar-toggler-padding-x); @include font-size(var(--navbar-toggler-font-size)); line-height: 1; color: var(--navbar-color); background-color: transparent; // remove default button style border: var(--border-width) solid var(--navbar-toggler-border-color); // remove default button style @include border-radius(var(--navbar-toggler-border-radius)); @include transition(var(--navbar-toggler-transition)); &:hover { text-decoration: none; } &:focus { text-decoration: none; outline: 0; box-shadow: 0 0 0 var(--navbar-toggler-focus-width); } } // Keep as a separate element so folks can easily override it with another icon // or image file as needed. .navbar-toggler-icon { display: inline-block; width: 1.5em; height: 1.5em; vertical-align: middle; background-image: var(--navbar-toggler-icon-bg); background-repeat: no-repeat; background-position: center; background-size: 100%; } .navbar-nav-scroll { max-height: var(--scroll-height, 75vh); overflow-y: auto; } // scss-docs-start navbar-expand-loop // Generate series of `.navbar-expand-*` responsive classes for configuring // where your navbar collapses. .navbar-expand { @each $breakpoint in map.keys($grid-breakpoints) { $next: breakpoint-next($breakpoint, $grid-breakpoints); $infix: breakpoint-infix($next, $grid-breakpoints); // stylelint-disable-next-line scss/selector-no-union-class-name &#{$infix} { @include media-breakpoint-up($next) { flex-wrap: nowrap; justify-content: flex-start; .navbar-nav { flex-direction: row; .dropdown-menu { position: absolute; } .nav-link { padding-inline-end: var(--navbar-nav-link-padding-x); padding-inline-start: var(--navbar-nav-link-padding-x); } } .navbar-nav-scroll { overflow: visible; } .navbar-collapse { display: flex !important; // stylelint-disable-line declaration-no-important flex-basis: auto; } .navbar-toggler { display: none; } .offcanvas { // stylelint-disable declaration-no-important position: static; z-index: auto; flex-grow: 1; width: auto !important; height: auto !important; visibility: visible !important; background-color: transparent !important; border: 0 !important; transform: none !important; @include box-shadow(none); @include transition(none); // stylelint-enable declaration-no-important .offcanvas-header { display: none; } .offcanvas-body { display: flex; flex-grow: 0; padding: 0; overflow-y: visible; } } } } } } // scss-docs-end navbar-expand-loop // Navbar themes // // Styles for switching between navbars with light or dark background. .navbar-light { @include deprecate('`.navbar-light`', 'v5.2.0', 'v6.0.0', true); } .navbar-dark, .navbar[data-bs-theme='dark'], .navbar[data-theme='dark'] { // scss-docs-start navbar-dark-css-vars --navbar-color: #{$navbar-dark-color}; --navbar-hover-color: #{$navbar-dark-hover-color}; --navbar-disabled-color: #{$navbar-dark-disabled-color}; --navbar-active-color: #{$navbar-dark-active-color}; --navbar-brand-color: #{$navbar-dark-brand-color}; --navbar-brand-hover-color: #{$navbar-dark-brand-hover-color}; --navbar-toggler-border-color: #{$navbar-dark-toggler-border-color}; --navbar-toggler-icon-bg: #{escape-svg($navbar-dark-toggler-icon-bg)}; // scss-docs-end navbar-dark-css-vars } @if $enable-dark-mode { @include color-mode(dark) { .navbar-toggler-icon { --navbar-toggler-icon-bg: #{escape-svg($navbar-dark-toggler-icon-bg)}; } } }