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 the mobile version #2003

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
30 changes: 30 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-line-height: #{$breadcrumb-line-height}; // Boosted mod
--#{$prefix}breadcrumb-color: #{$breadcrumb-color}; // Boosted mod
--#{$prefix}breadcrumb-bg: #{$breadcrumb-bg};
--#{$prefix}breadcrumb-border-radius: #{$breadcrumb-border-radius};
Expand All @@ -19,6 +20,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
line-height: var(--#{$prefix}breadcrumb-line-height); // Boosted mod
color: var(--#{$prefix}breadcrumb-color); // Boosted mod
list-style: none;
background-color: var(--#{$prefix}breadcrumb-bg);
Expand All @@ -44,6 +46,34 @@
}
}

// Boosted mod: Handle responsive
display: none;

@include media-breakpoint-up(md) {
display: block;
}

@include media-breakpoint-down(md) {
&:first-child:last-child,
&:nth-last-child(2) {
display: block;
}

&:nth-last-child(2) {
padding-left: 0;

&::before {
float: left;
padding-right: 0 #{"/* rtl:ignore */"};
padding-left: var(--#{$prefix}breadcrumb-item-padding-x) #{"/* rtl:ignore */"};
color: var(--#{$prefix}breadcrumb-divider-color);
content: var(--#{$prefix}breadcrumb-divider, escape-svg($breadcrumb-divider)) #{"/* rtl:"} var(--#{$prefix}breadcrumb-divider, escape-svg($breadcrumb-divider-flipped)) #{"*/"};
transform: scaleX(-1) #{"/* rtl:"} scaleX(1) #{"*/"};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of transforming it automatically, I'm wondering if we shouldn't provide a $breadcrumb-divider-mobile (not sure about the naming). Because if you choose "/" as a divider, in mobile mode you probably don't want it to be "".

}
}
}
// End mod

&.active {
color: var(--#{$prefix}breadcrumb-item-active-color);
}
Expand Down
9 changes: 5 additions & 4 deletions scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2044,18 +2044,19 @@ $title-bar-border-color-dark: $gray-700 !default;
// Breadcrumbs

// scss-docs-start breadcrumb-variables
$breadcrumb-font-size: $font-size-sm !default;
$breadcrumb-font-size: $font-size-sm !default; // Boosted mod: instead of `null`
$breadcrumb-font-weight: $font-weight-bold !default; // Boosted mod
$breadcrumb-line-height: $line-height-sm !default; // Boosted mod

$breadcrumb-padding-y: .5rem !default;
$breadcrumb-padding-y: .4375rem !default; // Boosted mod: instead of `0`
$breadcrumb-padding-x: 0 !default;
$breadcrumb-item-padding-x: $spacer * .5 !default;
$breadcrumb-item-padding-x: $spacer * .5 !default; // Boosted mod: instead of `.5rem`
$breadcrumb-margin-bottom: 1rem !default;
$breadcrumb-color: var(--#{$prefix}emphasis-color) !default; // Boosted mod
$breadcrumb-bg: null !default;
$breadcrumb-divider-color: null !default; // Boosted mod: instead of `var(--#{$prefix}secondary-color)`
$breadcrumb-active-color: null !default; // Boosted mod: instead of `var(--#{$prefix}secondary-color)`
$breadcrumb-divider: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 14' width='7' height='10'><path d='m-.4 12 2 2 7-7-7-7-2 2 5 5z'/></svg>") !default;
$breadcrumb-divider: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 14' width='7' height='10'><path d='m-.4 12 2 2 7-7-7-7-2 2 5 5z'/></svg>") !default; // Boosted mod: instead of `quote("/")`
$breadcrumb-divider-flipped: $breadcrumb-divider !default;
$breadcrumb-border-radius: null !default;
// scss-docs-end breadcrumb-variables
Expand Down
5 changes: 5 additions & 0 deletions site/content/docs/5.3/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ Learn more by reading the new [color modes documentation]({{< docsref "/customiz

- <span class="badge text-warning-emphasis bg-warning">Deprecated</span> The `.alert-variant()` mixin is now deprecated. We now [use a Sass loop]({{< docsref "/components/alerts#sass-loops" >}}) directly to modify the component's default CSS variables for each variant.

- **Breadcrumb**
- <span class="badge bg-success">New</span> Breadcrumbs now support responsive display.

- **Cards**
- Cards now have a `color` set on them to improve rendering across color modes.

Expand Down Expand Up @@ -275,6 +278,7 @@ Learn more by reading the new [color modes documentation]({{< docsref "/customiz
<li><code>--bs-box-shadow-lg</code></li>
<li><code>--bs-box-shadow-sm</code></li>
<li><code>--bs-box-shadow</code></li>
<li><code>--bs-breadcrumb-line-height</code></li>
<li><code>--bs-breakpoint-lg</code></li>
<li><code>--bs-breakpoint-md</code></li>
<li><code>--bs-breakpoint-sm</code></li>
Expand Down Expand Up @@ -378,6 +382,7 @@ Learn more by reading the new [color modes documentation]({{< docsref "/customiz
<li><code>$border-color-dark</code></li>
<li><code>$border-color-translucent-dark</code></li>
<li><code>$border-radius-xxl</code></li>
<li><code>$breadcrumb-line-height</code></li>
<li><code>$btn-color</code></li>
<li><code>$card-subtitle-color</code></li>
<li><code>$card-title-color</code></li>
Expand Down