Skip to content
Open
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
3 changes: 3 additions & 0 deletions projects/components/avatar/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// export what ./public_api exports so we can import with the lib name like this:
// import { ModuleA } from 'libname'
export * from './public_api';
5 changes: 5 additions & 0 deletions projects/components/avatar/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
1 change: 1 addition & 0 deletions projects/components/avatar/public_api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { ZvAvatar } from './src/avatar.component';
11 changes: 11 additions & 0 deletions projects/components/avatar/src/avatar.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@switch (displayType()) {
@case ('avatar') {
<mat-icon class="zv-avatar__icon">person</mat-icon>
}
@case ('initials') {
<span class="zv-avatar__initials">{{ initials() }}</span>
}
@case ('image') {
<img class="zv-avatar__image" [src]="image()" [alt]="name() || ''" (error)="imageError.set(true)" />
}
}
108 changes: 108 additions & 0 deletions projects/components/avatar/src/avatar.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
zv-avatar {
display: inline-flex;
align-items: center;
justify-content: center;
overflow: hidden;
user-select: none;
flex-shrink: 0;
}

// Sizes
.zv-avatar--small {
width: 24px;
height: 24px;

.zv-avatar__icon {
font-size: 15px;
width: 15px;
height: 15px;
}

.zv-avatar__initials {
font-size: 12px;
}
}

.zv-avatar--medium {
width: 40px;
height: 40px;

.zv-avatar__icon {
font-size: 25px;
width: 25px;
height: 25px;
}

.zv-avatar__initials {
font-size: 16px;
}
}

.zv-avatar--large {
width: 120px;
height: 120px;

.zv-avatar__icon {
font-size: 80px;
width: 80px;
height: 80px;
}

.zv-avatar__initials {
font-size: 45px;
}
}

// Variants
.zv-avatar--round {
border-radius: 50%;
}

.zv-avatar--square {
&.zv-avatar--small {
border-radius: 2px;
}

&.zv-avatar--medium {
border-radius: 4px;
}

&.zv-avatar--large {
border-radius: 8px;
}
}

// Type colors
.zv-avatar--type-avatar {
background-color: #dfe0ff;
color: var(--zv-components-font);
}

.zv-avatar--type-initials {
background-color: #dfe0ff;
color: var(--zv-components-font);
}

.zv-avatar--type-image {
background-color: transparent;
}

// Elements
.zv-avatar__icon {
display: flex;
align-items: center;
justify-content: center;
}

.zv-avatar__initials {
font-weight: 500;
line-height: 1;
letter-spacing: 0.02em;
}

.zv-avatar__image {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: inherit;
}
Loading
Loading