From 4c928a422052655a9e610a64b408174e8458f3d8 Mon Sep 17 00:00:00 2001 From: Ninjaws Date: Sun, 24 Nov 2024 17:45:37 +0100 Subject: [PATCH] [Updated] Some more --- .../project-card/project-card.component.html | 72 ++++++------------- .../project-card/project-card.component.ts | 9 ++- src/app/projects/projects.component.ts | 1 + 3 files changed, 32 insertions(+), 50 deletions(-) diff --git a/src/app/project-card/project-card.component.html b/src/app/project-card/project-card.component.html index d9c16dd..470cfdc 100644 --- a/src/app/project-card/project-card.component.html +++ b/src/app/project-card/project-card.component.html @@ -17,63 +17,37 @@ - + +
+ + +

+ {{ project.description }} +

-
- -

- {{ project.description }} -

- - - - - - - -
+ + +
-

+

Try it here!

- +
diff --git a/src/app/project-card/project-card.component.ts b/src/app/project-card/project-card.component.ts index 820acb9..ea16e9d 100644 --- a/src/app/project-card/project-card.component.ts +++ b/src/app/project-card/project-card.component.ts @@ -27,6 +27,8 @@ export class ProjectCardComponent { @ViewChild('description') descriptionElement!: ElementRef; isExpanded = false; isTruncated = false; + isTextVisible = true; + fullHeight: string = '13rem'; constructor(private cdr: ChangeDetectorRef) {} @@ -38,8 +40,9 @@ export class ProjectCardComponent { // Check if the description is being cut off checkIfTruncated() { const element = this.descriptionElement.nativeElement; + this.fullHeight = `${this.descriptionElement.nativeElement.scrollHeight}px`; + console.log(this.fullHeight); this.isTruncated = element.scrollHeight > element.offsetHeight; - console.log(this.isTruncated); } // Toggle expand/collapse @@ -47,6 +50,10 @@ export class ProjectCardComponent { this.isExpanded = !this.isExpanded; if (this.isExpanded) { this.isTruncated = false; + this.isTextVisible = false; + setTimeout(() => { + this.isTextVisible = true; + }, 500) } else { this.isTruncated = true; } diff --git a/src/app/projects/projects.component.ts b/src/app/projects/projects.component.ts index be5ba5a..12fb420 100644 --- a/src/app/projects/projects.component.ts +++ b/src/app/projects/projects.component.ts @@ -16,6 +16,7 @@ export class ProjectsComponent { title: 'Quiz App', year: '2024', description: + // 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + 'A little quiz game, using questions from the Open Trivia Database. This API only allows one request per 5 seconds. ' + '\n\nTo combat this, the app collects all available questions in its own database. ' + 'To ensure the data stays fresh, it repeats this process every night, by creating a backup table, and then swapping it with the active one once it is finished. ' +