mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
fix dependency icon and layout
This commit is contained in:
@@ -3,16 +3,25 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'
|
|||||||
import { EmverPipesModule } from '@start9labs/shared'
|
import { EmverPipesModule } from '@start9labs/shared'
|
||||||
import { Dependency, MarketplacePkg } from '../../../types'
|
import { Dependency, MarketplacePkg } from '../../../types'
|
||||||
import { RouterModule } from '@angular/router'
|
import { RouterModule } from '@angular/router'
|
||||||
import { TuiAvatarModule } from '@taiga-ui/experimental'
|
import { TuiAvatarModule, TuiLineClampModule } from '@taiga-ui/kit'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'marketplace-dep-item',
|
selector: 'marketplace-dep-item',
|
||||||
template: `
|
template: `
|
||||||
<div class="outer-container">
|
<div class="outer-container">
|
||||||
<div class="inner-container">
|
<tui-avatar
|
||||||
<tui-avatar class="dep-img" [src]="getImage(dep.key)"></tui-avatar>
|
class="dep-img"
|
||||||
<div class="wrapper-margin">
|
[rounded]="true"
|
||||||
<div class="inner-container-title">
|
[size]="'l'"
|
||||||
|
[avatarUrl]="getImage(dep.key)"
|
||||||
|
></tui-avatar>
|
||||||
|
<div>
|
||||||
|
<tui-line-clamp
|
||||||
|
[linesLimit]="2"
|
||||||
|
[content]="titleContent"
|
||||||
|
></tui-line-clamp>
|
||||||
|
<ng-template #titleContent>
|
||||||
|
<div class="title">
|
||||||
<span>
|
<span>
|
||||||
{{ getTitle(dep.key) }}
|
{{ getTitle(dep.key) }}
|
||||||
</span>
|
</span>
|
||||||
@@ -23,20 +32,27 @@ import { TuiAvatarModule } from '@taiga-ui/experimental'
|
|||||||
</ng-container>
|
</ng-container>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<span class="inner-container-description">
|
</ng-template>
|
||||||
{{ dep.value.description }}
|
<tui-line-clamp
|
||||||
</span>
|
[linesLimit]="2"
|
||||||
</div>
|
[content]="descContent"
|
||||||
|
class="description"
|
||||||
|
></tui-line-clamp>
|
||||||
|
<ng-template #descContent>
|
||||||
|
{{ dep.value.description }}
|
||||||
|
</ng-template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
styles: [
|
styles: [
|
||||||
`
|
`
|
||||||
.outer-container {
|
.outer-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1.5rem;
|
||||||
|
padding: 1rem 1.25rem;
|
||||||
background-color: rgb(63 63 70 / 0.4);
|
background-color: rgb(63 63 70 / 0.4);
|
||||||
border-radius: 0.75rem;
|
border-radius: 0.75rem;
|
||||||
padding: 0.75rem 1.25rem;
|
|
||||||
gap: 0.5rem;
|
|
||||||
filter: drop-shadow(0 10px 8px rgb(0 0 0 / 0.04))
|
filter: drop-shadow(0 10px 8px rgb(0 0 0 / 0.04))
|
||||||
drop-shadow(0 4px 3px rgb(0 0 0 / 0.1));
|
drop-shadow(0 4px 3px rgb(0 0 0 / 0.1));
|
||||||
|
|
||||||
@@ -46,60 +62,43 @@ import { TuiAvatarModule } from '@taiga-ui/experimental'
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.inner-container {
|
.title {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
|
||||||
gap: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.inner-container-title {
|
|
||||||
margin-bottom: 0.25rem;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.25rem;
|
gap: 0.25rem;
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
span {
|
span {
|
||||||
display: block;
|
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
line-height: 1.5rem;
|
line-height: 1.5rem;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: rgb(250 250 250 / 0.9);
|
color: rgb(250 250 250 / 0.9);
|
||||||
overflow: hidden;
|
|
||||||
display: -webkit-box;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
-webkit-line-clamp: 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.inner-container-description {
|
.description {
|
||||||
font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
line-height: 1.25rem;
|
line-height: 1.25rem;
|
||||||
color: rgb(250 250 250 / 0.7);
|
color: rgb(250 250 250 / 0.7);
|
||||||
height: 2.75rem;
|
|
||||||
overflow: hidden;
|
|
||||||
display: -webkit-box;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
-webkit-line-clamp: 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
::ng-deep .dep-img {
|
::ng-deep .dep-img {
|
||||||
width: 4rem;
|
|
||||||
pointer-events: none;
|
|
||||||
border-radius: 100%;
|
|
||||||
object-fit: cover;
|
|
||||||
filter: drop-shadow(0 10px 8px rgb(0 0 0 / 0.04))
|
filter: drop-shadow(0 10px 8px rgb(0 0 0 / 0.04))
|
||||||
drop-shadow(0 4px 3px rgb(0 0 0 / 0.1));
|
drop-shadow(0 4px 3px rgb(0 0 0 / 0.1));
|
||||||
}
|
}
|
||||||
|
|
||||||
.wrapper-margin {
|
|
||||||
margin-top: 0.75rem;
|
|
||||||
}
|
|
||||||
`,
|
`,
|
||||||
],
|
],
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, RouterModule, TuiAvatarModule, EmverPipesModule],
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
RouterModule,
|
||||||
|
TuiAvatarModule,
|
||||||
|
EmverPipesModule,
|
||||||
|
TuiLineClampModule,
|
||||||
|
],
|
||||||
})
|
})
|
||||||
export class MarketplaceDepItemComponent {
|
export class MarketplaceDepItemComponent {
|
||||||
@Input({ required: true })
|
@Input({ required: true })
|
||||||
@@ -111,7 +110,8 @@ export class MarketplaceDepItemComponent {
|
|||||||
getImage(key: string): string {
|
getImage(key: string): string {
|
||||||
const icon = this.pkg.dependencyMetadata[key]?.icon
|
const icon = this.pkg.dependencyMetadata[key]?.icon
|
||||||
// @TODO fix when registry api is updated to include mimetype in icon url
|
// @TODO fix when registry api is updated to include mimetype in icon url
|
||||||
return icon ? `data:image/png;base64,${icon}` : key.substring(0, 2)
|
// return icon ? `data:image/png;base64,${icon}` : key.substring(0, 2)
|
||||||
|
return icon ? icon : key.substring(0, 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
getTitle(key: string): string {
|
getTitle(key: string): string {
|
||||||
|
|||||||
Reference in New Issue
Block a user