Skip to content

Commit

Permalink
GB3-1685: Make discover maps generic as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Tugark committed Jan 16, 2025
1 parent 304cbd7 commit bd3210c
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 107 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
<li class="link-grid-list-item">
<a [href]="this.url" [title]="this.title" rel="noopener noreferrer" target="_blank" class="link-grid-list-item__wrapper">
<div class="link-grid-list-item__wrapper__content">
<p class="mat-subtitle-2 link-grid-list-item__wrapper__content__header">
@if (this.entryType) {
<strong>{{ this.entryType }}</strong>
}
@if (this.entryDate) {
{{ this.entryDate }}
}
</p>
<li class="link-grid-list-item" [class.link-grid-list-item--large]="size === 'large'">
@if (this.internalLink) {
<a [routerLink]="this.internalLink" [queryParams]="this.internalQueryParams" [title]="this.title" class="link-grid-list-item__wrapper">
<ng-container [ngTemplateOutlet]="content"></ng-container>
</a>
} @else {
<a [href]="this.url" [title]="this.title" rel="noopener noreferrer" target="_blank" class="link-grid-list-item__wrapper">
<ng-container [ngTemplateOutlet]="content"></ng-container>
</a>
}
</li>

<p class="mat-headline-6 link-grid-list-item__wrapper__content__title">{{ this.title }}</p>
<p class="link-grid-list-item__wrapper__content__text">
<ng-content></ng-content>
</p>
<ng-template #content>
@if (this.imageUrl && this.size === 'large') {
<img [src]="this.imageUrl" alt="" class="link-grid-list-item__wrapper__image" />
}
<div class="link-grid-list-item__wrapper__content">
<div class="mat-subtitle-2 link-grid-list-item__wrapper__content__header">
@if (this.entryType) {
<strong>{{ this.entryType }}</strong>
}
@if (this.entryDate) {
{{ this.entryDate }}
}
</div>
</a>
</li>

<div class="mat-headline-6 link-grid-list-item__wrapper__content__title">{{ this.title }}</div>
<div class="link-grid-list-item__wrapper__content__text">
<ng-content></ng-content>
</div>
</div>
</ng-template>
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@
/// The border width around the link elements
$border-width: 8px; // todo: make variable

/// Number of entries to be displayed
$number-of-entries: 3;

.link-grid-list-item {
--number-of-entries: 3;
--height: 310px;

&--large {
--number-of-entries: 2;
--height: 649px;
}

@include collapsing-flexbox-list.list__item(
$border-width: $border-width,
$max-content-width: ktzh-variables.$zh-layout-max-content-width,
$number-of-entries: $number-of-entries,
$height: 310px
$number-of-entries: var(--number-of-entries),
$height: var(--height)
);

.link-grid-list-item__wrapper {
Expand All @@ -22,8 +27,17 @@ $number-of-entries: 3;
color: ktzh-variables.$zh-black100 !important;
}
}

@include collapsing-flexbox-list.list__item__wrapper(ktzh-variables.$zh-white);

.link-grid-list-item__wrapper__image {
display: block;
width: 100%;
height: 327px;
object-fit: cover;
object-position: center;
}

.link-grid-list-item__wrapper__content {
padding: 40px;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
import {Component, Input} from '@angular/core';
import {MainPage} from '../../../../enums/main-page.enum';
import {RouterLink} from '@angular/router';
import {NgTemplateOutlet} from '@angular/common';

/**
* Can be used for internal and external links; if "internalLink" is set, "url" is ignored and a RouterLink is used.
*
* "imageUrl" is used as a hero image; it is only applicable if size is "large".
*
* If size is "small", a row contains up to 3 elements; if size is "large", a row contains up to 2 elements.
*
* EntryType and EntryDate are optional and displayed as smaller introductory text above the title; entryType is displayed in bold.
*
*/
@Component({
selector: 'link-grid-list-item',
templateUrl: './link-grid-list-item.component.html',
styleUrls: ['./link-grid-list-item.component.scss'],
imports: [RouterLink, NgTemplateOutlet],
})
export class LinkGridListItemComponent {
@Input() public title!: string;
@Input() public url!: string;
@Input() public internalLink?: MainPage;
@Input() public internalQueryParams?: Record<string, string>;
@Input() public entryType?: string;
@Input() public entryDate?: string;
@Input() public size: 'small' | 'large' = 'small';
@Input() public imageUrl?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,19 @@
loadingCompletedText="Fehler beim Laden der Karten zum Entdecken."
loadingText="Lade neue Karten zum Entdecken..."
></content-loading-state>
<div class="discover-maps">
<ul class="discover-maps__list">
<li *ngFor="let discoverMapsEntry of this.discoverMapsItems" class="discover-maps__list__item">
<div class="discover-maps__list__item__wrapper">
<div class="discover-maps__list__item__wrapper__content">
<img
[src]="discoverMapsEntry.image.url"
[alt]="discoverMapsEntry.image.altText ?? ''"
class="discover-maps__list__item__wrapper__content__image"
/>
<div class="discover-maps__list__item__wrapper__content__container">
<h3 class="ktzh-h3-medium ktzh-h3-medium--bold discover-maps__list__item__wrapper__content__container__title">
{{ discoverMapsEntry.title }}
</h3>
<p class="discover-maps__list__item__wrapper__content__container__text">{{ discoverMapsEntry.description }}</p>
<a [color]="'accent'" [queryParams]="{initialMapIds: discoverMapsEntry.mapId}" [routerLink]="mainPageEnum.Maps" mat-flat-button
>Karte öffnen</a
>
</div>
</div>
</div>
</li>
</ul>
</div>
<link-grid-list>
@for (discoverMapsEntry of this.discoverMapsItems; track $index) {
<link-grid-list-item
[internalLink]="mainPageEnum.Maps"
[internalQueryParams]="{initialMapIds: discoverMapsEntry.mapId}"
[title]="discoverMapsEntry.title"
[size]="'large'"
[imageUrl]="discoverMapsEntry.image.url"
>
<p>
{{ discoverMapsEntry.description }}
</p>
</link-grid-list-item>
}
</link-grid-list>
<p *ngIf="discoverMapsItems.length === 0 && loadingState === 'loaded'" class="mat-caption">Aktuell gibt es keine Empfehlungen.</p>
Original file line number Diff line number Diff line change
@@ -1,60 +0,0 @@
@use 'functions/helper.function' as functions;
@use 'mixins/helpers.mixin' as mixins;
@use 'variables/ktzh-design-variables' as ktzh-variables;
@use 'mixins/collapsing-flexbox-list.mixin' as collapsing-flexbox-list;

/// The border width around the link elements
$border-width: 8px;

/// Number of entries to be displayed
$number-of-entries: 2;

.discover-maps {
width: 100%;

.discover-maps__list {
@include collapsing-flexbox-list.list($border-width);

.discover-maps__list__item {
@include collapsing-flexbox-list.list__item(
$border-width: $border-width,
$max-content-width: ktzh-variables.$zh-layout-max-content-width,
$number-of-entries: $number-of-entries,
$height: 649px
);

.discover-maps__list__item__wrapper {
@include collapsing-flexbox-list.list__item__wrapper(ktzh-variables.$zh-white);

&:hover {
& .discover-maps__list__item__wrapper__content__container__title {
color: ktzh-variables.$zh-black100 !important; // override title color on hover
}
}

.discover-maps__list__item__wrapper__content {
.discover-maps__list__item__wrapper__content__image {
display: block;
width: 100%;
height: 327px;
object-fit: cover;
object-position: center;
}

.discover-maps__list__item__wrapper__content__container {
padding: 40px;

.discover-maps__list__item__wrapper__content__container__title {
@include mixins.multiline-ellipsis(2);
color: ktzh-variables.$zh-blue;
}

.discover-maps__list__item__wrapper__content__container__text {
@include mixins.multiline-ellipsis(6);
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
></content-loading-state>
<link-grid-list>
@for (newsEntry of this.news; track $index) {
<link-grid-list-item [title]="newsEntry.title" [entryType]="'Mitteilung'" [entryDate]="newsEntry.date">
<link-grid-list-item [url]="newsEntry.link" [title]="newsEntry.title" [entryType]="'Mitteilung'" [entryDate]="newsEntry.date">
{{ newsEntry.teaserText }}
</link-grid-list-item>
}
Expand Down

0 comments on commit bd3210c

Please sign in to comment.