From 30f520745c778061437fc9b1f49cf202336006b3 Mon Sep 17 00:00:00 2001 From: Valery Melou Date: Fri, 2 Aug 2024 22:40:03 +0100 Subject: [PATCH] fix: article's display --- .../src/lib/blog-article.component.html | 12 ++++++++---- libs/shared/ui/src/lib/code/code.component.html | 2 +- libs/shared/ui/src/lib/code/code.component.ts | 2 ++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libs/blog/feature-article/src/lib/blog-article.component.html b/libs/blog/feature-article/src/lib/blog-article.component.html index 90632d4..86dc7eb 100644 --- a/libs/blog/feature-article/src/lib/blog-article.component.html +++ b/libs/blog/feature-article/src/lib/blog-article.component.html @@ -22,15 +22,19 @@
- {{ article.cover.title }} + {{ article.cover.description }}
}
+ @if (article.abstract) { +

{{ article.abstract }}

+
+ }

@if (node.data.target.fields.title) {
- {{ node.data.target.fields.title }} + {{ node.data.target.fields.description }}
} diff --git a/libs/shared/ui/src/lib/code/code.component.html b/libs/shared/ui/src/lib/code/code.component.html index aaf58a9..ea7a9bf 100644 --- a/libs/shared/ui/src/lib/code/code.component.html +++ b/libs/shared/ui/src/lib/code/code.component.html @@ -1,5 +1,5 @@ @if (code) { - @if (code.split(' ').length === 1) { + @if (inline) {
} @else {
diff --git a/libs/shared/ui/src/lib/code/code.component.ts b/libs/shared/ui/src/lib/code/code.component.ts index d5d409f..6964dc7 100644 --- a/libs/shared/ui/src/lib/code/code.component.ts +++ b/libs/shared/ui/src/lib/code/code.component.ts @@ -20,6 +20,7 @@ export class CodeComponent { @Input() set code(value: string) { this._code = value; + this.inline = !value.includes('\n'); this.highlight(); } @@ -29,6 +30,7 @@ export class CodeComponent { @Input() language!: string; highlightedCode!: SafeHtml; + inline = false; private languages = [ 'javascript',