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

fix(ui5-avatar): correct badge style #8564

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
23 changes: 14 additions & 9 deletions packages/main/src/themes/Avatar.css
Original file line number Diff line number Diff line change
Expand Up @@ -257,32 +257,37 @@
right: 0;
width: 1.125rem;
height: 1.125rem;
background: var(--sapButton_Emphasized_Background);
border: var(--sapButton_Emphasized_Background);
border-radius: 1rem;
color: var(--sapContent_BadgeTextColor);
justify-content: center;
font-family: "72override", var(--sapFontFamily);
font-size: var(--sapFontSmallSize);
}
color: var(--sapBackgroundColor);

--_ui5-badge-height: 1.125rem;
--_ui5-badge-border-radius: 50%;

::slotted([ui5-badge][slot="badge"]) {
padding: 0.1875rem;
--ui5-badge-color-scheme-1-background: var(--sapButton_Emphasized_Background);
--ui5-badge-color-scheme-1-color: var(--sapButton_Emphasized_TextColor);
--ui5-badge-color-scheme-1-border: var(--sapButton_Emphasized_BorderColor);
}

:host([_size="L"]) ::slotted([slot="badge"]),
:host([size="L"]) ::slotted([slot="badge"]) {
width: 1.25rem;
height: 1.25rem;

--_ui5-badge-height: 1.25rem;
--_ui5-badge-icon-width: 0.875rem;
}

:host([_size="XL"]) ::slotted([slot="badge"]),
:host([size="XL"]) ::slotted([slot="badge"]) {
padding: 0.375rem;
width: 1.75rem;
height: 1.75rem;

--_ui5-badge-height: 1.75rem;
--_ui5-badge-icon-width: 1rem;
}

/* Slotted Badge - Square Avatar Shape */
:host([shape="Square"]) ::slotted([slot="badge"]) {
bottom: -0.125rem;
right: -0.125rem;
Expand Down
16 changes: 2 additions & 14 deletions packages/main/src/themes/Badge.css
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@

[ui5-icon],
::slotted([ui5-icon]) {
width: 0.75rem;
min-width: 0.75rem;
width: var(--_ui5-badge-icon-width);
min-width: var(--_ui5-badge-icon-width);
height: var(--_ui5-badge-height);
min-height: var(--_ui5-badge-height);
color: inherit;
Expand Down Expand Up @@ -590,16 +590,4 @@
background-color: var(--ui5-badge-set2-color-scheme-2-active-background);
border-color: var(--ui5-badge-set2-color-scheme-2-active-border);
color: var(--ui5-badge-set2-color-scheme-2-active-color);
}

/* ---Slotted Badges--- */
/* [ui5-avatar] - Badge icon styles */
/* Make icon take full width minus padding.
[ui5-avatar] is the only component using an icon for badge,
therefore no additional scoping is needed. */
:host([slot="badge"]) ::slotted([ui5-icon][slot="icon"]) {
width: 100%;
height: 100%;
min-width: 100%;
min-height: 100%;
}
1 change: 1 addition & 0 deletions packages/main/src/themes/base/Badge-parameters.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
--_ui5-badge-padding-inline-icon-only: 0.1875rem;
--_ui5-badge-text-transform: uppercase;
--_ui5-badge-icon-height: 0.75em;
--_ui5-badge-icon-width: 0.75rem;
--_ui5-badge-icon-gap: 0.125rem;
--_ui5-badge-font-size: var(--sapFontSmallSize);
--_ui5-badge-font: "72override", var(--sapFontFamily);
Expand Down