Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit abcb849

Browse files
authored
feat(avatar): added fit modifier (#2565)
1 parent 1b316bd commit abcb849

File tree

7 files changed

+247
-157
lines changed

7 files changed

+247
-157
lines changed

.changeset/happy-turkeys-hang.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@ebay/skin": minor
3+
---
4+
5+
feat(avatar): added custom fit avatar

dist/avatar/avatar.css

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,33 @@
11
.avatar {
22
align-items: center;
3-
background-color: #84b4fb;
43
border-radius: 50%;
5-
color: #002a69;
64
display: inline-flex;
75
font-size: var(--font-size-large-2);
86
font-weight: var(--font-weight-bold);
97
height: 48px;
108
justify-content: center;
119
line-height: 48px;
1210
overflow: hidden;
11+
position: relative;
1312
width: 48px;
1413
}
14+
.avatar:after {
15+
background: rgba(0, 0, 0, 0.05);
16+
bottom: 0;
17+
content: "";
18+
display: block;
19+
left: 0;
20+
pointer-events: none;
21+
position: absolute;
22+
right: 0;
23+
top: 0;
24+
}
25+
.avatar > img {
26+
display: inline-block;
27+
max-height: 100%;
28+
max-width: 100%;
29+
object-fit: contain;
30+
}
1531

1632
.avatar > svg {
1733
height: 100%;
@@ -24,6 +40,10 @@
2440
width: 48px;
2541
}
2642

43+
.avatar--fit > img {
44+
object-fit: contain;
45+
}
46+
2747
.avatar--teal {
2848
background-color: #84b4fb;
2949
color: #002a69;

dist/mixins/_utility-mixins.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
white-space: nowrap;
2424
}
2525

26-
@mixin image-treatment($border-radius: 8px) {
26+
@mixin image-treatment($border-radius: 8px, $display: flex) {
2727
align-items: center;
2828
border-radius: $border-radius;
29-
display: flex;
29+
display: $display;
3030
justify-content: center;
3131
overflow: hidden;
3232
position: relative;

0 commit comments

Comments
 (0)