
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
@libs-ui/components-avatar
Advanced tools
avatar
là một component Avatar linh hoạt dùng cho ứng dụng Angular. Component này cho phép hiển thị avatar người dùng với nhiều tùy chọn khác nhau như hình ảnh, chữ cái đầu, màu sắc tự động, và hỗ trợ fallback khi ảnh bị lỗi.
Để cài đặt component avatar
, sử dụng npm hoặc yarn:
npm install @libs-ui/components-avatar
hoặc
yarn add @libs-ui/components-avatar
// example.component.ts
import { Component } from '@angular/core';
import { LibsUiComponentsAvatarComponent } from '@libs-ui/components-avatar';
@Component({
selector: 'app-example',
standalone: true,
imports: [LibsUiComponentsAvatarComponent],
template: `
<libs_ui-components-avatar
[linkAvatar]="'https://example.com/avatar.jpg'"
[textAvatar]="'Nguyễn Văn A'"
[idGenColor]="'user-123'"
[size]="40">
</libs_ui-components-avatar>
`
})
export class ExampleComponent {
// Component logic
}
// example.component.ts
import { Component } from '@angular/core';
import { LibsUiComponentsAvatarComponent } from '@libs-ui/components-avatar';
@Component({
selector: 'app-example',
standalone: true,
imports: [LibsUiComponentsAvatarComponent],
templateUrl: './example.component.html'
})
export class ExampleComponent {
// Component logic
}
<!-- example.component.html -->
<libs_ui-components-avatar
[linkAvatar]="'https://example.com/avatar.jpg'"
[linkAvatarError]="'https://example.com/default-avatar.jpg'"
[textAvatar]="'Nguyễn Văn A'"
[idGenColor]="'user-123'"
[size]="40"
[typeShape]="'circle'">
</libs_ui-components-avatar>
Tên | Kiểu dữ liệu | Mặc định | Mô tả |
---|---|---|---|
linkAvatar | string | - | Đường dẫn của hình ảnh avatar |
linkAvatarError | string | - | Đường dẫn của hình ảnh thay thế khi avatar chính bị lỗi |
textAvatar | string | - | Văn bản hiển thị khi không có hình ảnh (thường là chữ cái đầu của tên) |
idGenColor | string | - | ID dùng để tạo màu nền tự động khi sử dụng văn bản |
size | 16 | 24 | 32 | 40 | 48 | 64 | 32 | Kích thước của avatar (tính bằng pixel) |
typeShape | 'circle' | 'rectangle' | 'circle' | Hình dạng của avatar (tròn hoặc vuông) |
classInclude | string | 'mr-[8px]' | CSS class bổ sung cho container chính |
classImageInclude | string | '' | CSS class bổ sung cho thẻ img |
getLastTextAfterSpace | boolean | false | Nếu true, chỉ lấy chữ cái đầu tiên của từ cuối cùng trong textAvatar |
Tên | Kiểu dữ liệu | Mô tả |
---|---|---|
outAvatarError | void | Sự kiện được kích hoạt khi linkAvatar bị lỗi và không có linkAvatarError |
export interface IAvatarConfig {
classImageInclude?: string;
classInclude?: string;
size?: TYPE_SIZE_AVATAR_CONFIG;
linkAvatar?: string;
linkAvatarError?: string;
idGenColor?: string;
textAvatar?: string;
typeShape?: TYPE_SHAPE_AVATAR;
getLastTextAfterSpace?: boolean;
}
export type TYPE_SIZE_AVATAR_CONFIG = 16 | 24 | 32 | 40 | 48 | 64;
export type TYPE_SHAPE_AVATAR = 'circle' | 'rectangle';
TypeScript (user-avatar.component.ts):
import { Component } from '@angular/core';
import { LibsUiComponentsAvatarComponent } from '@libs-ui/components-avatar';
@Component({
selector: 'app-user-avatar',
standalone: true,
imports: [LibsUiComponentsAvatarComponent],
templateUrl: './user-avatar.component.html'
})
export class UserAvatarComponent {
user = {
id: 'user-123',
name: 'Nguyễn Văn A',
avatar: 'https://example.com/avatar.jpg'
};
handleAvatarError() {
console.log('Không thể tải được hình ảnh avatar');
}
}
HTML (user-avatar.component.html):
<libs_ui-components-avatar
[linkAvatar]="user.avatar"
[textAvatar]="user.name"
[idGenColor]="user.id"
[size]="40"
(outAvatarError)="handleAvatarError()">
</libs_ui-components-avatar>
TypeScript (avatar-group.component.ts):
import { Component } from '@angular/core';
import { LibsUiComponentsAvatarComponent } from '@libs-ui/components-avatar';
@Component({
selector: 'app-avatar-group',
standalone: true,
imports: [LibsUiComponentsAvatarComponent],
templateUrl: './avatar-group.component.html'
})
export class AvatarGroupComponent {
users = [
{
id: 'user-1',
name: 'Nguyễn Văn A',
avatar: 'https://example.com/avatar1.jpg',
size: 64
},
{
id: 'user-2',
name: 'Trần Thị B',
avatar: 'https://example.com/avatar2.jpg',
size: 48
},
{
id: 'user-3',
name: 'Lê Văn C',
avatar: 'https://example.com/avatar3.jpg',
size: 32
},
{
id: 'user-4',
name: 'Phạm Thị D',
avatar: null,
size: 24
}
];
}
HTML (avatar-group.component.html):
<div class="flex items-center space-x-2">
@for (user of users; track user.id) {
<libs_ui-components-avatar
[linkAvatar]="user.avatar"
[textAvatar]="user.name"
[idGenColor]="user.id"
[size]="user.size"
[typeShape]="user.id === 'user-4' ? 'rectangle' : 'circle'">
</libs_ui-components-avatar>
}
</div>
FAQs
## Giới thiệu
The npm package @libs-ui/components-avatar receives a total of 1,577 weekly downloads. As such, @libs-ui/components-avatar popularity was classified as popular.
We found that @libs-ui/components-avatar demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.