komponents erstellen

This commit is contained in:
Tizian.Breuch
2025-09-08 18:17:32 +02:00
parent 27cfa1e925
commit ee8974e2ff
71 changed files with 1627 additions and 27 deletions

View File

@@ -0,0 +1 @@
<p>kpi-card works!</p>

View File

@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-kpi-card',
imports: [],
templateUrl: './kpi-card.component.html',
styleUrl: './kpi-card.component.css'
})
export class KpiCardComponent {
}

View File

@@ -0,0 +1 @@
<p>form-field works!</p>

View File

@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-form-field',
imports: [],
templateUrl: './form-field.component.html',
styleUrl: './form-field.component.css'
})
export class FormFieldComponent {
}

View File

@@ -0,0 +1 @@
<p>slide-toggle works!</p>

View File

@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-slide-toggle',
imports: [],
templateUrl: './slide-toggle.component.html',
styleUrl: './slide-toggle.component.css'
})
export class SlideToggleComponent {
}

View File

@@ -0,0 +1 @@
<p>page-header works!</p>

View File

@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-page-header',
imports: [],
templateUrl: './page-header.component.html',
styleUrl: './page-header.component.css'
})
export class PageHeaderComponent {
}

View File

@@ -0,0 +1 @@
<p>search-bar works!</p>

View File

@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-search-bar',
imports: [],
templateUrl: './search-bar.component.html',
styleUrl: './search-bar.component.css'
})
export class SearchBarComponent {
}

View File

@@ -0,0 +1 @@
<p>user-profile works!</p>

View File

@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-user-profile',
imports: [],
templateUrl: './user-profile.component.html',
styleUrl: './user-profile.component.css'
})
export class UserProfileComponent {
}

View File

@@ -0,0 +1 @@
<p>dialog works!</p>

View File

@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-dialog',
imports: [],
templateUrl: './dialog.component.html',
styleUrl: './dialog.component.css'
})
export class DialogComponent {
}

View File

@@ -0,0 +1 @@
<p>menu works!</p>

View File

@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-menu',
imports: [],
templateUrl: './menu.component.html',
styleUrl: './menu.component.css'
})
export class MenuComponent {
}

View File

@@ -0,0 +1,18 @@
/* src\app\shared\snackbar\components\snackbar-container\snackbar-container.component.css */
/* Stile, die NUR für den Container gelten */
.snackbar-container-wrapper {
position: fixed;
bottom: 2rem;
left: 50%;
transform: translateX(-50%);
z-index: 1050;
width: 350px;
max-width: 90vw;
height: 300px;
pointer-events: none;
}
.snackbar-container-wrapper.position-top {
bottom: auto;
top: 2rem;
}

View File

@@ -0,0 +1,8 @@
<div class="snackbar-container-wrapper" [class.position-top]="(position$ | async) === 'top'">
<app-snackbar
*ngFor="let snack of (snackbars$ | async); let i = index"
[message]="snack.message"
[style]="getSnackbarStyle(i, snack.state, (position$ | async)!)"
(close)="closeSnackbar(snack.id)">
</app-snackbar>
</div>

View File

@@ -0,0 +1,46 @@
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { Observable } from 'rxjs';
import { Snackbar, SnackbarService } from '../../services/snackbar.service';
import { SnackbarComponent } from '../snackbar/snackbar.component';
@Component({
selector: 'app-snackbar-container',
standalone: true,
imports: [CommonModule, SnackbarComponent],
templateUrl: './snackbar-container.component.html',
styleUrl: './snackbar-container.component.css'
})
export class SnackbarContainerComponent {
snackbars$: Observable<Snackbar[]>;
position$: Observable<'top' | 'bottom'>;
constructor(private snackbarService: SnackbarService) {
this.snackbars$ = this.snackbarService.snackbars$;
this.position$ = this.snackbarService.position$;
}
// Diese Methode gehört hierher, da der Container die Position aller Kinder kennen muss.
getSnackbarStyle(index: number, state: 'visible' | 'fading', position: 'top' | 'bottom'): { [key: string]: any } {
const snackbarHeight = 75;
const verticalOffset = index * snackbarHeight;
const positionProperty = position === 'bottom' ? 'bottom' : 'top';
const opacity = 1 - (index * 0.2);
const scale = 1 - (index * 0.02);
const visibleStyle = {
[positionProperty]: `${verticalOffset}px`,
'opacity': opacity,
'transform': `scale(${scale})`,
'z-index': 1000 - index
};
const fadingStyle = { ...visibleStyle, 'opacity': 0, 'transform': 'scale(0.8)' };
return state === 'visible' ? visibleStyle : fadingStyle;
}
closeSnackbar(id: number): void {
this.snackbarService.close(id);
}
}

View File

@@ -0,0 +1,47 @@
/* src\app\shared\snackbar\components\snackbar\snackbar.component.css */
/* Stile, die NUR für eine einzelne Snackbar gelten */
:host {
position: absolute;
left: 0;
right: 0;
display: flex;
align-items: center;
gap: 1rem;
padding: 0.75rem;
border-radius: var(--border-radius-md);
background-color: var(--color-surface);
color: var(--color-text);
border: 1px solid var(--color-border);
box-shadow: var(--box-shadow-md);
pointer-events: auto;
transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.snackbar-icon-container {
flex-shrink: 0;
width: 32px;
height: 32px;
border-radius: 50%;
display: grid;
place-items: center;
background-color: #dcfce7;
color: #166534;
}
:host-context(body.dark-theme) .snackbar-icon-container {
background-color: #166534;
color: #dcfce7;
}
.snackbar-message {
flex-grow: 1;
font-weight: 500;
}
.snackbar-close-btn {
flex-shrink: 0;
width: 32px;
height: 32px;
font-size: 1.5rem;
color: var(--color-text-light);
}
.snackbar-close-btn:hover {
background-color: var(--color-body-bg);
}

View File

@@ -0,0 +1,10 @@
<div class="snackbar-icon-container">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path>
<polyline points="22 4 12 14.01 9 11.01"></polyline>
</svg>
</div>
<span class="snackbar-message">{{ message }}</span>
<button class="btn btn-icon snackbar-close-btn" (click)="onClose()" data-tooltip="Schließen">
&times;
</button>

View File

@@ -0,0 +1,17 @@
import { Component, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'app-snackbar',
standalone: true,
imports: [],
templateUrl: './snackbar.component.html',
styleUrl: './snackbar.component.css'
})
export class SnackbarComponent {
@Input() message: string = '';
@Output() close = new EventEmitter<void>();
onClose() {
this.close.emit();
}
}

View File

@@ -0,0 +1 @@
<p>alert works!</p>

View File

@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-alert',
imports: [],
templateUrl: './alert.component.html',
styleUrl: './alert.component.css'
})
export class AlertComponent {
}

View File

@@ -0,0 +1 @@
<p>button works!</p>

View File

@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-button',
imports: [],
templateUrl: './button.component.html',
styleUrl: './button.component.css'
})
export class ButtonComponent {
}

View File

@@ -0,0 +1 @@
<p>card works!</p>

View File

@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-card',
imports: [],
templateUrl: './card.component.html',
styleUrl: './card.component.css'
})
export class CardComponent {
}

View File

@@ -0,0 +1 @@
<p>chip works!</p>

View File

@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-chip',
imports: [],
templateUrl: './chip.component.html',
styleUrl: './chip.component.css'
})
export class ChipComponent {
}

View File

@@ -0,0 +1 @@
<p>icon works!</p>

View File

@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-icon',
imports: [],
templateUrl: './icon.component.html',
styleUrl: './icon.component.css'
})
export class IconComponent {
}

View File

@@ -0,0 +1 @@
<p>status-pill works!</p>

View File

@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-status-pill',
imports: [],
templateUrl: './status-pill.component.html',
styleUrl: './status-pill.component.css'
})
export class StatusPillComponent {
}