diff --git a/webapp/src/app/shared/ui/app-publication-card/app-publication-card.component.html b/webapp/src/app/shared/ui/app-publication-card/app-publication-card.component.html index 3c84c3f8..1e1b85b7 100644 --- a/webapp/src/app/shared/ui/app-publication-card/app-publication-card.component.html +++ b/webapp/src/app/shared/ui/app-publication-card/app-publication-card.component.html @@ -15,15 +15,33 @@ -
- @for (topic of topics(); track topic.id) { - - } - @for (author of authors(); track author.id) { - - } +
+
+ label + Themen +
+
+ @for (topic of visibleTopics(); track topic.id) { + + } +
+ +
+
+ person + Autoren +
+
+ @for (author of visibleAuthors(); track author.id) { + + } + @if (hiddenAuthorCount() > 0) { + +{{ hiddenAuthorCount() }} + } +
+
diff --git a/webapp/src/app/shared/ui/app-publication-card/app-publication-card.component.scss b/webapp/src/app/shared/ui/app-publication-card/app-publication-card.component.scss index ce2961eb..abe550c6 100644 --- a/webapp/src/app/shared/ui/app-publication-card/app-publication-card.component.scss +++ b/webapp/src/app/shared/ui/app-publication-card/app-publication-card.component.scss @@ -1,3 +1,10 @@ +:host { + ::ng-deep .mat-mdc-card-header-text { + min-width: 0; + width: 100%; + } +} + .card-content { display: flex; flex-direction: column; @@ -5,11 +12,46 @@ height: 100%; } +mat-card-title { + display: -webkit-box; + width: 100%; + -webkit-box-orient: vertical; + -webkit-line-clamp: 4; + line-clamp: 4; + overflow: hidden; + line-height: 1.3rem; + height: calc(1.3rem * 4); +} + .subtitle { + display: block; + width: 100%; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + color: var(--sg-text-muted); + line-height: 1.25rem; + height: 1.25rem; +} + +.chip-section { + display: flex; + flex-direction: column; + gap: 0.5rem; +} + +.chip-section-header { display: flex; align-items: center; - gap: 0.5rem; + gap: 0.25rem; color: var(--sg-text-muted); + font-size: 0.875rem; + + mat-icon { + width: 18px; + height: 18px; + font-size: 18px; + } } .metrics { @@ -42,6 +84,35 @@ height: 100%; } +.chips-column { + flex-direction: column; + flex-wrap: nowrap; + align-items: flex-start; + // 3 rows reserved (32px chip height + 8px gap each) so the divider below + // sits at the same position regardless of how many topics exist. + min-height: calc(3 * 32px + 2 * 0.5rem); +} + +.chips-authors { + flex-wrap: nowrap; + align-content: flex-start; + // 1 row reserved, capped so overflowing chips never push the divider down. + min-height: 32px; + max-height: 32px; + overflow: hidden; +} + +.chip-overflow { + display: inline-flex; + align-items: center; + padding: 0.25rem 0.5rem; + border-radius: var(--sg-radius-sm); + background: var(--sg-surface-soft); + color: var(--sg-text-muted); + font-size: 0.8rem; + font-weight: 600; +} + .mat-card-content { display: flex; flex-direction: column; diff --git a/webapp/src/app/shared/ui/app-publication-card/app-publication-card.component.ts b/webapp/src/app/shared/ui/app-publication-card/app-publication-card.component.ts index 41c8a29a..71d1777e 100644 --- a/webapp/src/app/shared/ui/app-publication-card/app-publication-card.component.ts +++ b/webapp/src/app/shared/ui/app-publication-card/app-publication-card.component.ts @@ -11,6 +11,9 @@ import { LanguageCodePipe } from '../../pipes/language-code.pipe'; import { AppTopicChipComponent } from '../app-topic-chip/app-topic-chip.component'; import { AppAuthorChipComponent } from '../app-author-chip/app-author-chip.component'; +const MAX_VISIBLE_TOPICS = 3; +const MAX_VISIBLE_AUTHORS = 3; + @Component({ selector: 'app-publication-card', imports: [ @@ -55,4 +58,12 @@ export class AppPublicationCardComponent { .map((authorship) => authorship.author) .filter((author): author is DehydratedAuthor => !!author); }); + + visibleTopics = computed(() => this.topics().slice(0, MAX_VISIBLE_TOPICS)); + + visibleAuthors = computed(() => this.authors().slice(0, MAX_VISIBLE_AUTHORS)); + + hiddenAuthorCount = computed(() => + Math.max(this.authors().length - MAX_VISIBLE_AUTHORS, 0), + ); }