use shared year-range-slider component in news page

This commit is contained in:
2026-08-03 22:23:36 +02:00
parent b02358e3a0
commit cea32deba2
3 changed files with 11 additions and 82 deletions
@@ -28,28 +28,14 @@
</mat-select>
</mat-form-field>
<div class="year-field">
<div class="year-field__head">
<span class="year-field__label">Datum</span>
<span class="year-field__range">
{{ yearFrom.value }} – {{ yearTo.value }}
</span>
</div>
<mat-slider [min]="minYear" [max]="maxYear" step="1" discrete>
<input matSliderStartThumb [formControl]="yearFrom" />
<input matSliderEndThumb [formControl]="yearTo" />
</mat-slider>
</div>
<button
class="reset-filter-btn"
mat-stroked-button
type="button"
(click)="resetFilters()"
aria-label="Filter zurücksetzen">
<mat-icon>filter_alt_off</mat-icon>
<span>Zurücksetzen</span>
</button>
<app-year-range-slider
class="year-field"
[minYear]="minYear"
[maxYear]="maxYear"
[startYear]="yearFrom.value"
[endYear]="yearTo.value"
(startYearChange)="yearFrom.setValue($event)"
(endYearChange)="yearTo.setValue($event)" />
</div>
</ng-template>
@@ -57,54 +57,7 @@
}
.year-field {
display: flex;
flex-direction: column;
justify-content: center;
min-width: 220px;
padding: 0 6px;
margin-top: -20px;
}
.year-field__head {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 10px;
font-size: 12px;
margin-bottom: 20px;
}
.year-field__label {
color: var(--sg-text-muted);
font-weight: 600;
}
.year-field__range {
color: var(--sg-text);
font-weight: 600;
white-space: nowrap;
}
.year-field mat-slider {
width: 100%;
margin: 0;
}
.reset-filter-btn {
min-width: 132px;
height: 42px;
padding: 0 14px;
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
color: var(--sg-text);
background: var(--sg-surface);
mat-icon {
margin-right: 6px;
width: 20px;
height: 20px;
font-size: 20px;
}
min-width: 280px;
}
@media (max-width: 600px) {
+2 -12
View File
@@ -13,9 +13,6 @@ 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 { MatSliderModule } from '@angular/material/slider';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { WorksService } from '../../api';
import {
@@ -28,6 +25,7 @@ import {
NEWS_MIN_YEAR,
} from '../../shared/ui/news-card/news-card.component';
import { SelectorOption } from '../../shared/ui/query-param-selector/query-param-selector.component';
import { YearRangeSliderComponent } from '../../shared/ui/year-range-slider/year-range-slider.component';
interface NewsArticle extends NewsArticleBase {
author?: string | null;
@@ -49,11 +47,9 @@ type SortOrder = 'desc' | 'asc';
ReactiveFormsModule,
MatFormFieldModule,
MatSelectModule,
MatSliderModule,
MatButtonModule,
MatIconModule,
CardSearchComponent,
NewsCardComponent,
YearRangeSliderComponent,
],
templateUrl: './news.component.html',
styleUrl: './news.component.scss',
@@ -138,12 +134,6 @@ export class NewsComponent implements OnInit {
.subscribe(() => this.applyFilters());
}
resetFilters(): void {
this.relevanceFilter.setValue([]);
this.yearFrom.setValue(this.minYear);
this.yearTo.setValue(this.maxYear);
}
private applyFilters(): void {
const relevance =
this.relevanceFilter.value.length > 0