moved project card into generic component
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<mat-card
|
||||
class="card-content popup"
|
||||
appearance="outlined"
|
||||
[routerLink]="getDetailLink(project())">
|
||||
<mat-card-header>
|
||||
<mat-card-title>{{ project().title }}</mat-card-title>
|
||||
<mat-card-subtitle class="subtitle">
|
||||
{{ project().type | uppercase }}</mat-card-subtitle
|
||||
>
|
||||
</mat-card-header>
|
||||
|
||||
<mat-divider />
|
||||
|
||||
<mat-card-content class="mat-card-content">
|
||||
<div class="metrics">
|
||||
<div class="metric-item">
|
||||
<mat-icon>date_range</mat-icon>
|
||||
<span
|
||||
>Von {{ project().start_date | date: 'dd.MM.yyyy' }} bis
|
||||
{{ project().end_date | date: 'dd.MM.yyyy' }}</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
|
||||
<mat-divider />
|
||||
|
||||
<mat-card-footer>
|
||||
<mat-card-actions class="card-actions">
|
||||
<a
|
||||
class="card-action"
|
||||
[routerLink]="getDetailLink(project())"
|
||||
matButton="outlined"
|
||||
(click)="$event.stopPropagation()">
|
||||
<mat-icon>open_in_new</mat-icon>
|
||||
Öffnen
|
||||
</a>
|
||||
</mat-card-actions>
|
||||
</mat-card-footer>
|
||||
</mat-card>
|
||||
@@ -0,0 +1,43 @@
|
||||
.card-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
|
||||
.metrics {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.metric-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
|
||||
.card-actions {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.card-action {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.mat-card-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
height: 100%;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import { Component, input } from '@angular/core';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { FundingProject } from '../../../api';
|
||||
import { DatePipe, UpperCasePipe } from '@angular/common';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
@Component({
|
||||
selector: 'app-project-card',
|
||||
imports: [
|
||||
MatCardModule,
|
||||
DatePipe,
|
||||
UpperCasePipe,
|
||||
RouterLink,
|
||||
MatDividerModule,
|
||||
MatIconModule,
|
||||
MatButtonModule,
|
||||
],
|
||||
templateUrl: './app-project-card.component.html',
|
||||
styleUrl: './app-project-card.component.scss',
|
||||
})
|
||||
export class AppProjectCardComponent {
|
||||
project = input.required<FundingProject>();
|
||||
|
||||
getDetailLink(fundingProject: FundingProject): string | null {
|
||||
if (fundingProject.type === 'bund') {
|
||||
const encodedId = encodeURIComponent(fundingProject.id);
|
||||
return '/projects/bund/' + encodedId;
|
||||
} else if (fundingProject.type === 'dfg') {
|
||||
return '/projects/dfg/' + fundingProject.id;
|
||||
} else if (fundingProject.type === 'eu') {
|
||||
return '/projects/eu/' + fundingProject.id;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user