Skip to content

Instantly share code, notes, and snippets.

View romanejaquez's full-sized avatar
💭
I may be slow to respond.

Roman Jaquez romanejaquez

💭
I may be slow to respond.
View GitHub Profile
import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs';
import { StepModel } from '../models/step.model';
const STEPS = [
{ stepIndex: 1, isComplete: false },
{ stepIndex: 2, isComplete: false },
{ stepIndex: 3, isComplete: false }
];
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { StepModel } from '../../models/step.model';
import { Observable } from 'rxjs';
import { StepsService } from '../../services/steps.service';
import { Router } from '@angular/router';
@Component({
selector: 'app-form-page',
templateUrl: './form-page.component.html',
styleUrls: ['./form-page.component.scss'],
<div class="form-page-container">
<app-steps></app-steps>
<div class="step-page-container">
<div class="form-step">
<ng-container [ngSwitch]="(currentStep | async)?.stepIndex">
<ng-container *ngSwitchCase="'1'">
<app-step-template [step]="(currentStep | async)"></app-step-template>
</ng-container>
<ng-container *ngSwitchCase="'2'">
<app-step-template [step]="(currentStep | async)"></app-step-template>
@import './../../../assets/colors.scss';
.form-page-container {
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
}
.step-page-container {
<div class="app-page-container">
<router-outlet></router-outlet>
</div>
.app-page-container {
height: 100%;
width: 100%;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
<div class="complete-page">
<div class="complete-page-inner">
<span class="completed-page-check material-icons">check_circle</span>
<h2>Completed Wizard!</h2>
</div>
</div>
@import './../../../assets/colors.scss';
.complete-page {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { StepModel } from 'src/app/models/step.model';
import { StepsService } from 'src/app/services/steps.service';
import { Observable } from 'rxjs';
@Component({
selector: 'app-steps',
templateUrl: './steps.component.html',
styleUrls: ['./steps.component.scss'],
encapsulation: ViewEncapsulation.None
<div class="form-steps-container">
<ng-container *ngFor="let step of steps | async; let i = index;">
<div (click)="onStepClick(step)"
[ngClass]="{ 'step-complete': step.isComplete, 'step-incomplete': !step.isComplete, 'step-current': (currentStep | async)?.stepIndex === step.stepIndex }"
class="step-bubble">{{ step.stepIndex }}</div>
<div *ngIf="i < (steps | async)?.length - 1" class="step-divider"></div>
</ng-container>
</div>