Skip to content

Commit

Permalink
refactor(author-card): removed unused line-clamp lib, changed author …
Browse files Browse the repository at this point in the history
…card component
  • Loading branch information
DamianBrzezinskiHoA committed Aug 16, 2024
1 parent de61818 commit 286b608
Show file tree
Hide file tree
Showing 19 changed files with 23 additions and 357 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ <h2 id="article-title" class="flex text-[40px] font-bold">
</div>
</section>
<aside class="order-3 col-span-12 lg:col-span-4">
<al-author-card
[author]="articleDetails().author"
[clampText]="true"
[linkable]="true"
/>
<al-author-card [author]="articleDetails().author" [linkable]="true" />

@defer (on viewport(view); on timer(500ms)) {
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@

<ng-container author-info-description>
@defer {
<al-dynamic-text-clamp
[text]="author().description"
[textClasses]="descriptionClass()"
/>
<a [routerLink]="['/', 'author', author().slug] | alLocalize">
<p
class="author-description line-clamp-5 text-justify text-sm"
[innerHTML]="sanitizedDescription().description"
></p>
</a>
} @placeholder {
<div class="hidden">
{{ author().description }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ import {
ChangeDetectionStrategy,
Component,
computed,
inject,
input,
SecurityContext,
} from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { RouterLink } from '@angular/router';

import { UiAuthorCard } from '@angular-love/blog/authors/types';
import { AlLocalizePipe } from '@angular-love/blog/i18n/util';
import { AvatarComponent } from '@angular-love/blog/shared/ui-avatar';
import { DynamicTextClampComponent } from '@angular-love/blog/shared/ui-dynamic-text-clamp';
import {
SocialMediaIconItemComponent,
SocialMediaIconItemUi,
Expand All @@ -24,7 +26,6 @@ import { AuthorCardTemplateComponent } from './author-card-template.component';
imports: [
AuthorCardTemplateComponent,
AvatarComponent,
DynamicTextClampComponent,
RouterLink,
NgTemplateOutlet,
SocialMediaIconItemComponent,
Expand All @@ -39,16 +40,10 @@ import { AuthorCardTemplateComponent } from './author-card-template.component';
},
})
export class AuthorCardComponent {
author = input.required<UiAuthorCard>();
readonly author = input.required<UiAuthorCard>();
readonly linkable = input<boolean>(false);

clampText = input<boolean>();
linkable = input<boolean>(false);

descriptionClass = computed(
() => 'text-sm' + (this.clampText() ? ' line-clamp-3' : ''),
);

socials = computed<SocialMediaIconItemUi[]>(() => {
protected readonly socials = computed<SocialMediaIconItemUi[]>(() => {
const { github, twitter, linkedin } = this.author();
return [
{
Expand All @@ -72,4 +67,14 @@ export class AuthorCardComponent {
social.usernameOrPageId !== null,
);
});

private readonly _domSanitizer = inject(DomSanitizer);

private sanitize(val: string): string {
return this._domSanitizer.sanitize(SecurityContext.HTML, val) || '';
}

readonly sanitizedDescription = computed<{ description: string }>(() => ({
description: this.sanitize(this.author().description),
}));
}
36 changes: 0 additions & 36 deletions libs/blog/shared/ui-dynamic-text-clamp/.eslintrc.json

This file was deleted.

7 changes: 0 additions & 7 deletions libs/blog/shared/ui-dynamic-text-clamp/README.md

This file was deleted.

23 changes: 0 additions & 23 deletions libs/blog/shared/ui-dynamic-text-clamp/jest.config.ts

This file was deleted.

20 changes: 0 additions & 20 deletions libs/blog/shared/ui-dynamic-text-clamp/project.json

This file was deleted.

2 changes: 0 additions & 2 deletions libs/blog/shared/ui-dynamic-text-clamp/src/index.ts

This file was deleted.

This file was deleted.

This file was deleted.

Empty file.

This file was deleted.

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions libs/blog/shared/ui-dynamic-text-clamp/src/test-setup.ts

This file was deleted.

Loading

0 comments on commit 286b608

Please sign in to comment.