Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breadcrumb: Add dark variant #1430

Merged
merged 6 commits into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bundlewatch.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
{
"path": "./dist/css/boosted.min.css",
"maxSize": "33.5 kB"
"maxSize": "33.75 kB"
},
{
"path": "./dist/js/boosted.bundle.js",
Expand Down
17 changes: 17 additions & 0 deletions scss/_breadcrumb.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
--#{$prefix}breadcrumb-margin-bottom: #{$breadcrumb-margin-bottom};
@include rfs($breadcrumb-font-size, --#{$prefix}breadcrumb-font-size);
--#{$prefix}breadcrumb-font-weight: #{$breadcrumb-font-weight}; // Boosted mod
--#{$prefix}breadcrumb-color: #{$breadcrumb-color}; // Boosted mod
louismaximepiton marked this conversation as resolved.
Show resolved Hide resolved
--#{$prefix}breadcrumb-bg: #{$breadcrumb-bg};
--#{$prefix}breadcrumb-border-radius: #{$breadcrumb-border-radius};
--#{$prefix}breadcrumb-divider-color: #{$breadcrumb-divider-color};
Expand All @@ -18,6 +19,7 @@
margin-bottom: var(--#{$prefix}breadcrumb-margin-bottom);
@include font-size(var(--#{$prefix}breadcrumb-font-size));
font-weight: var(--#{$prefix}breadcrumb-font-weight); // Boosted mod
color: var(--#{$prefix}breadcrumb-color); // Boosted mod
list-style: none;
background-color: var(--#{$prefix}breadcrumb-bg);
@include border-radius(var(--#{$prefix}breadcrumb-border-radius));
Expand Down Expand Up @@ -46,3 +48,18 @@
color: var(--#{$prefix}breadcrumb-item-active-color);
}
}

// Boosted mod
.breadcrumb-dark {
// scss-docs-start breadcrumb-dark-css-vars
--#{$prefix}breadcrumb-color: #{$breadcrumb-dark-color};
--#{$prefix}breadcrumb-bg: #{$breadcrumb-dark-bg};
--#{$prefix}breadcrumb-divider-color: #{$breadcrumb-dark-divider-color};
--#{$prefix}breadcrumb-item-active-color: #{$breadcrumb-dark-active-color};
// scss-docs-end breadcrumb-dark-css-vars

.breadcrumb-item::before {
filter: $invert-filter;
julien-deramond marked this conversation as resolved.
Show resolved Hide resolved
}
}
// End mod
8 changes: 8 additions & 0 deletions scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1835,6 +1835,7 @@ $breadcrumb-padding-y: .5rem !default;
$breadcrumb-padding-x: 0 !default;
$breadcrumb-item-padding-x: $spacer * .5 !default;
$breadcrumb-margin-bottom: 1rem !default;
$breadcrumb-color: $black !default; // Boosted mod
julien-deramond marked this conversation as resolved.
Show resolved Hide resolved
$breadcrumb-bg: null !default;
$breadcrumb-divider-color: null !default;
$breadcrumb-active-color: null !default;
Expand All @@ -1843,6 +1844,13 @@ $breadcrumb-divider-flipped: $breadcrumb-divider !default;
$breadcrumb-border-radius: null !default;
// scss-docs-end breadcrumb-variables

// scss-docs-start breadcrumb-dark-variables
$breadcrumb-dark-color: $white !default; // Boosted mod
$breadcrumb-dark-bg: null !default; // Boosted mod
$breadcrumb-dark-divider-color: $black !default; // Boosted mod: since the divider is inverted for svg reasons
julien-deramond marked this conversation as resolved.
Show resolved Hide resolved
$breadcrumb-dark-active-color: null !default; // Boosted mod
// scss-docs-end breadcrumb-dark-variables


// Carousel

Expand Down
32 changes: 32 additions & 0 deletions site/content/docs/5.2/components/breadcrumb.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,24 @@ You can also remove the divider setting `--bs-breadcrumb-divider: '';` (empty st
$breadcrumb-divider: none;
```

<!-- Boosted mod: Dark variant -->
## Dark variant

{{< added-in "5.2.1" >}}

Add `.breadcrumb-dark` to the `.breadcrumb` for a dark variant.

{{< example class="bg-dark" >}}
julien-deramond marked this conversation as resolved.
Show resolved Hide resolved
<nav aria-label="dark breadcrumb">
<ol class="breadcrumb breadcrumb-dark">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item"><a href="#">Library</a></li>
<li class="breadcrumb-item active" aria-current="page">Data</li>
</ol>
</nav>
{{< /example >}}
<!-- End mod -->

## Accessibility

Since breadcrumbs provide a navigation, it's a good idea to add a meaningful label such as `aria-label="breadcrumb"` to describe the type of navigation provided in the `<nav>` element, as well as applying an `aria-current="page"` to the last item of the set to indicate that it represents the current page.
Expand All @@ -106,6 +124,20 @@ As part of Boosted's evolving CSS variables approach, breadcrumbs now use local

{{< scss-docs name="breadcrumb-css-vars" file="scss/_breadcrumb.scss" >}}

<!-- Boosted mod: Dark variant -->
Customization through CSS variables can be seen on the `.breadcrumb-dark` modifier class where we override specific values without adding duplicate CSS selectors.

{{< scss-docs name="breadcrumb-dark-css-vars" file="scss/_breadcrumb.scss" >}}
<!-- End mod -->

### Sass variables

Variables for all breadcrumbs:
julien-deramond marked this conversation as resolved.
Show resolved Hide resolved

{{< scss-docs name="breadcrumb-variables" file="scss/_variables.scss" >}}

<!-- Boosted mod: Dark variant -->
Variables for [dark breadcrumb](#dark-variant):

{{< scss-docs name="breadcrumb-dark-variables" file="scss/_variables.scss" >}}
<!-- End mod -->