Skip to content

Commit 9045fb4

Browse files
authored
refactor: update avatar Lumo CSS to extend base styles (#9676)
1 parent 0d33e23 commit 9045fb4

File tree

2 files changed

+12
-30
lines changed

2 files changed

+12
-30
lines changed

packages/avatar/src/vaadin-avatar.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ class Avatar extends AvatarMixin(ElementMixin(ThemableMixin(LumoInjectionMixin(P
5656
return avatarStyles;
5757
}
5858

59+
static get lumoInjector() {
60+
return {
61+
includeBaseStyles: true,
62+
};
63+
}
64+
5965
/** @protected */
6066
render() {
6167
return html`

packages/vaadin-lumo-styles/src/components/avatar.css

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,25 @@
55
*/
66
@media lumo_components_avatar {
77
:host {
8-
position: relative;
9-
display: inline-block;
10-
flex: none;
11-
overflow: hidden;
12-
height: var(--vaadin-avatar-size, 64px);
13-
width: var(--vaadin-avatar-size, 64px);
8+
--vaadin-avatar-outline-width: var(--vaadin-focus-ring-width, 2px);
149
border: var(--vaadin-avatar-outline-width) solid transparent;
1510
margin: calc(var(--vaadin-avatar-outline-width) * -1);
16-
background-clip: content-box;
17-
--vaadin-avatar-outline-width: var(--vaadin-focus-ring-width, 2px);
1811
color: var(--lumo-secondary-text-color);
1912
background-color: var(--lumo-contrast-10pct);
20-
border-radius: 50%;
2113
outline: none;
22-
cursor: default;
23-
user-select: none;
24-
-webkit-tap-highlight-color: transparent;
2514
-webkit-font-smoothing: antialiased;
2615
-moz-osx-font-smoothing: grayscale;
27-
}
28-
29-
img {
30-
height: 100%;
31-
width: 100%;
32-
object-fit: cover;
16+
vertical-align: baseline;
3317
}
3418

3519
[part='icon'] {
3620
display: flex;
3721
align-items: center;
3822
justify-content: center;
39-
height: 100%;
4023
font-size: var(--vaadin-avatar-size, 64px);
4124
line-height: 1;
25+
mask: none;
26+
background: none;
4227
}
4328

4429
[part='icon']::before {
@@ -51,28 +36,19 @@
5136
font-family: var(--lumo-font-family);
5237
font-size: 2.4375em;
5338
font-weight: 500;
54-
fill: currentColor;
55-
}
56-
57-
:host([hidden]),
58-
[hidden] {
59-
display: none !important;
6039
}
6140

6241
:host([has-color-index]) {
63-
background-color: var(--vaadin-avatar-user-color);
6442
color: var(--lumo-base-color);
6543
}
6644

6745
:host([has-color-index])::before {
68-
position: absolute;
69-
content: '';
70-
inset: 0;
71-
border-radius: inherit;
46+
border: none;
7247
box-shadow: inset 0 0 0 2px var(--vaadin-avatar-user-color);
7348
}
7449

7550
:host([focus-ring]) {
51+
outline: none;
7652
border-color: var(--vaadin-focus-ring-color, var(--lumo-primary-color-50pct));
7753
}
7854

0 commit comments

Comments
 (0)