From 4c576931609523bef91f86dd643089b9b0b14742 Mon Sep 17 00:00:00 2001 From: Isabelle Chanclou Date: Thu, 3 Mar 2022 07:49:05 +0100 Subject: [PATCH] feat(components): add Nested Tabs (#1017) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Isabelle Chanclou Co-authored-by: Julien Déramond Co-authored-by: Louis-Maxime Piton --- .bundlewatch.config.json | 4 +- build/.pa11yci.json | 2 +- scss/_nav.scss | 16 ++++-- scss/_variables.scss | 1 + site/content/docs/5.1/components/navs-tabs.md | 53 ++++++++++++++++++- 5 files changed, 69 insertions(+), 7 deletions(-) diff --git a/.bundlewatch.config.json b/.bundlewatch.config.json index b9ded33ce1..697fe72806 100644 --- a/.bundlewatch.config.json +++ b/.bundlewatch.config.json @@ -26,11 +26,11 @@ }, { "path": "./dist/css/boosted.css", - "maxSize": "30.1 kB" + "maxSize": "30.2 kB" }, { "path": "./dist/css/boosted.min.css", - "maxSize": "28.0 kB" + "maxSize": "28.1 kB" }, { "path": "./dist/js/boosted.bundle.js", diff --git a/build/.pa11yci.json b/build/.pa11yci.json index f965a6751a..303c6ba75c 100644 --- a/build/.pa11yci.json +++ b/build/.pa11yci.json @@ -5,7 +5,7 @@ "runners": [ "axe" ], - "hideElements": ".bd-search, [id*='tarteaucitron'], #TableOfContents, .text-primary, .accordion-button:not(.collapsed), .active, [aria-current], select:disabled, [disabled] label, [disabled] + label, .modal, .bd-example nav, .badge.rounded-pill.bg-info.text-white, .exclude-from-pa11y-analysis, a.disabled, .form-check.form-switch", + "hideElements": ".bd-search, [id*='tarteaucitron'], #TableOfContents, .text-primary, .accordion-button:not(.collapsed), .active, [aria-current], select:disabled, [disabled] label, [disabled] + label, .modal, .bd-example nav, .badge.rounded-pill.bg-info.text-white, .exclude-from-pa11y-analysis, a.disabled, .form-check.form-switch, .nav-tabs .nav-item .nav-link.disabled", "ignore": [ "heading-order", "scrollable-region-focusable" diff --git a/scss/_nav.scss b/scss/_nav.scss index e346db995e..1f42d71102 100644 --- a/scss/_nav.scss +++ b/scss/_nav.scss @@ -52,7 +52,7 @@ // End mod .nav-link { - padding: subtract(1rem, $nav-tabs-border-width) map-get($spacers, 4); // Boosted mod + padding: subtract(1rem, $nav-tabs-border-width) subtract($nav-tabs-link-padding-x, $nav-tabs-border-width); // Boosted mod // stylelint-disable-next-line function-disallowed-list margin-bottom: calc(var(--#{$variable-prefix}tabs-spacing) * -1); background: none; @@ -98,7 +98,7 @@ // Boosted mod .nav-tabs-light { --#{$variable-prefix}tabs-spacing: #{$nav-tabs-border-width * .5}; - border-color: $gray-600; + border-color: $gray-500; .nav-link { // stylelint-disable-next-line function-disallowed-list @@ -125,6 +125,8 @@ .nav-pills { .nav-link { + padding-right: $nav-tabs-link-padding-x; + padding-left: $nav-tabs-link-padding-x; background: none; border: 0; @include border-radius($nav-pills-border-radius); @@ -180,7 +182,7 @@ .tab-content { // Boosted mod - padding: subtract($spacer, $nav-tabs-border-width); + padding: $spacer subtract($nav-tabs-link-padding-x, $nav-tabs-border-width); border: $nav-tabs-border-width solid; border-top: 0; // End mod @@ -188,6 +190,14 @@ > .tab-pane { display: none; } + + // Boosted mod + > .tab-pane-with-nested-tab { + display: none; + margin: $spacer * -1 subtract($nav-tabs-link-padding-x, $nav-tabs-border-width) * -1; + } + // End mod + > .active { display: block; } diff --git a/scss/_variables.scss b/scss/_variables.scss index 1e29ba213d..28e145db0a 100644 --- a/scss/_variables.scss +++ b/scss/_variables.scss @@ -1199,6 +1199,7 @@ $nav-link-disabled-color: $gray-500 !default; $nav-tabs-border-color: $black !default; $nav-tabs-border-width: $border-width !default; $nav-tabs-border-radius: $border-radius !default; +$nav-tabs-link-padding-x: 1.8125rem !default; // Boosted mod $nav-tabs-link-hover-border-color: $nav-tabs-border-color !default; $nav-tabs-link-active-color: $black !default; $nav-tabs-link-active-bg: $body-bg !default; diff --git a/site/content/docs/5.1/components/navs-tabs.md b/site/content/docs/5.1/components/navs-tabs.md index ea4d82a5c9..6d403eb42c 100644 --- a/site/content/docs/5.1/components/navs-tabs.md +++ b/site/content/docs/5.1/components/navs-tabs.md @@ -151,7 +151,6 @@ Takes the basic nav from above and adds the `.nav-tabs` class to generate a tabb ### Tabs light - Nav tabs light only differ visually, with a full width bottom border and a different active state. {{< example >}} @@ -170,6 +169,58 @@ Nav tabs light only differ visually, with a full width bottom border and a diffe {{< /example >}} + +### Nested tabs + +Nav tabs light is nested in a tab for adding a level of depth in information organization. + +{{< example >}} +
+ +
+ + +{{< /example >}} + ### Pills