feat(breadcrumb_badges): basic shrink support

This commit is contained in:
Elian Doran 2025-12-10 13:03:06 +02:00
parent 07b76b80f4
commit 9f274883e3
No known key found for this signature in database
2 changed files with 26 additions and 7 deletions

View File

@ -5,19 +5,21 @@
.breadcrumb-badges { .breadcrumb-badges {
display: flex; display: flex;
gap: 5px; gap: 5px;
min-width: 0;
flex-shrink: 1;
overflow: hidden;
--badge-radius: 12px;
.breadcrumb-badge { .breadcrumb-badge {
display: flex; display: flex;
align-items: center; align-items: center;
padding: 2px 6px; padding: 2px 6px;
border-radius: 12px; border-radius: var(--badge-radius);
font-size: 0.75em; font-size: 0.75em;
background-color: var(--color, --badge-background-color); background-color: var(--color, var(--badge-background-color));
color: white; color: white;
min-width: 0; min-width: 0;
text-overflow: ellipsis; flex-shrink: 1;
white-space: nowrap;
overflow: hidden;
&.clickable { &.clickable {
cursor: pointer; cursor: pointer;
@ -36,13 +38,30 @@
color: inherit; color: inherit;
text-decoration: none; text-decoration: none;
} }
> * {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
} }
.dropdown { .dropdown {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
border-radius: var(--badge-radius);
&.dropdown-backlinks-badge .dropdown-menu { &.dropdown-backlinks-badge .dropdown-menu {
min-width: 500px; min-width: 500px;
} }
.breadcrumb-badge {
border-radius: 0;
}
.btn { .btn {
border: 0; border: 0;
margin: 0; margin: 0;

View File

@ -112,7 +112,7 @@ function Badge({ icon, className, text, tooltip, onClick, href }: BadgeProps) {
className={clsx("breadcrumb-badge", className, { "clickable": !!onClick })} className={clsx("breadcrumb-badge", className, { "clickable": !!onClick })}
onClick={onClick} onClick={onClick}
> >
{href ? <a href={href}>{content}</a> : content} {href ? <a href={href}>{content}</a> : <span>{content}</span>}
</div> </div>
); );
} }
@ -130,7 +130,7 @@ function BadgeWithDropdown({ children, tooltip, className, dropdownOptions, ...p
hideToggleArrow hideToggleArrow
title={tooltip} title={tooltip}
titlePosition="bottom" titlePosition="bottom"
dropdownOptions={{ popperConfig: { placement: "bottom" } }} dropdownOptions={{ popperConfig: { placement: "bottom", strategy: "fixed" } }}
{...dropdownOptions} {...dropdownOptions}
>{children}</Dropdown> >{children}</Dropdown>
); );