EQ: add texts and stepper component

This commit is contained in:
Tykayn 2025-10-13 12:47:50 +02:00 committed by tykayn
parent 9de7b06579
commit d176f57dc5
12 changed files with 241 additions and 58 deletions

View file

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

View file

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SaeStepper } from './sae-stepper';
describe('SaeStepper', () => {
let component: SaeStepper;
let fixture: ComponentFixture<SaeStepper>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [SaeStepper]
})
.compileComponents();
fixture = TestBed.createComponent(SaeStepper);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View file

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

View file

@ -0,0 +1,7 @@
<div class="stepper">
@for (ii of stepArray; track ii) {
<div class="step {{ currentStep >= ii ? 'is-active' : 'is-inactive'}}">
{{ ii }}
</div>
}
</div>

View file

@ -0,0 +1,17 @@
:host {
.step {
border-radius: 1px solid grey;
padding: 1rem;
background: white;
&.is-active {
color: black;
border-color: blue;
}
&.is-inactive {
background: grey;
color: white;
}
}
}

View file

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Stepper } from './stepper';
describe('Stepper', () => {
let component: Stepper;
let fixture: ComponentFixture<Stepper>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [Stepper]
})
.compileComponents();
fixture = TestBed.createComponent(Stepper);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View file

@ -0,0 +1,30 @@
import {Component, EventEmitter, Input, Output} from '@angular/core';
import {JsonPipe} from '@angular/common';
@Component({
selector: 'sae-stepper',
imports: [
JsonPipe
],
templateUrl: './stepper.html',
styleUrl: './stepper.scss'
})
export class Stepper {
@Input() currentStep: number = 1;
@Input() minStep: number = 1;
@Input() maxStep: number = 3;
@Input() stepArray: Array<number> = [1, 2, 3];
@Output() changedStep: EventEmitter<any> = new EventEmitter();
constructor() {
this.stepArray = []
for (let ii = this.currentStep; ii < this.maxStep; ii++) {
this.stepArray.push(ii)
}
}
onClickStep(newValue: number) {
this.changedStep.emit(newValue)
}
}