refactor(news-list): re-style search bar and filters to improve alignment
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/pr-dev Build queued...

This commit is contained in:
2026-08-10 17:50:11 +02:00
parent 9e8ae16597
commit e2ae0c660a
3 changed files with 58 additions and 35 deletions
+18 -14
View File
@@ -18,18 +18,24 @@
<ng-template #additionalFiltersTmp>
<div class="additional-filters">
<mat-form-field
appearance="outline"
subscriptSizing="dynamic"
class="relevance-field">
<mat-select
[formControl]="relevanceFilter"
placeholder="Relevanz"
multiple>
<mat-option value="relevant">Relevant</mat-option>
<mat-option value="not_relevant">Nicht relevant</mat-option>
</mat-select>
</mat-form-field>
<app-filter-card>
<app-query-param-selector
class="relevance-field"
[options]="relevanceOptions"
queryParamKey="relevance"
label="Relevanz"
icon="check_circle"
[multiple]="true" />
@if (!isSearching()) {
<app-query-param-selector
class="sort-order-field"
[options]="sortingDirectionOptionsAll"
queryParamKey="sorting_order"
label="Sortierung"
icon="sort" />
}
</app-filter-card>
<app-year-range-slider
class="year-field"
@@ -59,7 +65,5 @@
[additionalFiltersTmp]="additionalFiltersTmp"
[noResultsTmp]="noResultsTmp"
[cardMinWidth]="380"
[sortingDirectionOptions]="sortingDirectionOptions()"
sortingDirectionLabel="Sortierung"
searchLabel="Nachrichten durchsuchen" />
</div>
+26 -10
View File
@@ -44,20 +44,36 @@
color: var(--sg-text-muted);
}
$card-min-width: 380px;
.additional-filters {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 40px;
display: grid;
grid-template-columns: repeat(auto-fill, minmax($card-min-width, 1fr));
align-items: stretch;
gap: 1.5rem;
padding: 0 1rem 1rem;
app-year-range-slider {
display: flex;
}
::ng-deep app-year-range-slider .year-filter {
height: 100%;
}
::ng-deep .mat-mdc-form-field-subscript-wrapper {
display: none;
}
::ng-deep .mat-mdc-form-field-icon-prefix {
padding: 0 4px 0 10px;
}
}
.relevance-field {
width: 180px;
}
.year-field {
min-width: 280px;
.relevance-field,
.sort-order-field {
flex: 1;
min-width: 0;
}
@media (max-width: 600px) {
+14 -11
View File
@@ -7,12 +7,10 @@ import {
signal,
} from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
import { FormControl, ReactiveFormsModule } from '@angular/forms';
import { FormControl } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { debounceTime, merge } from 'rxjs';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatSelectModule } from '@angular/material/select';
import { WorksService } from '../../api';
import {
@@ -24,7 +22,11 @@ import {
NewsCardComponent,
NEWS_MIN_YEAR,
} from '../../shared/ui/news-card/news-card.component';
import { SelectorOption } from '../../shared/ui/query-param-selector/query-param-selector.component';
import {
QueryParamSelectorComponent,
SelectorOption,
} from '../../shared/ui/query-param-selector/query-param-selector.component';
import { FilterCardComponent } from '../../shared/ui/filter-card/filter-card.component';
import { YearRangeSliderComponent } from '../../shared/ui/year-range-slider/year-range-slider.component';
interface NewsArticle extends NewsArticleBase {
@@ -44,11 +46,10 @@ type SortOrder = 'desc' | 'asc';
@Component({
selector: 'app-news',
imports: [
ReactiveFormsModule,
MatFormFieldModule,
MatSelectModule,
CardSearchComponent,
NewsCardComponent,
FilterCardComponent,
QueryParamSelectorComponent,
YearRangeSliderComponent,
],
templateUrl: './news.component.html',
@@ -64,11 +65,16 @@ export class NewsComponent implements OnInit {
readonly minYear = NEWS_MIN_YEAR;
readonly maxYear = new Date().getFullYear();
private readonly sortingDirectionOptionsAll: SelectorOption[] = [
readonly sortingDirectionOptionsAll: SelectorOption[] = [
{ value: 'desc', display_name: 'Neueste zuerst' },
{ value: 'asc', display_name: 'Älteste zuerst' },
];
readonly relevanceOptions: SelectorOption[] = [
{ value: 'relevant', display_name: 'Relevant' },
{ value: 'not_relevant', display_name: 'Nicht relevant' },
];
readonly relevanceFilter = new FormControl<string[]>([], {
nonNullable: true,
});
@@ -85,9 +91,6 @@ export class NewsComponent implements OnInit {
readonly searchQuery = signal('');
readonly isSearching = computed(() => this.searchQuery().trim().length > 0);
readonly sortingDirectionOptions = computed<SelectorOption[]>(() =>
this.isSearching() ? [] : this.sortingDirectionOptionsAll,
);
readonly page = computed<Page>(() => ({
page: this.currentPage,