Skip to content
Snippets Groups Projects
Commit b161b51a authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

chore(ui): add storybook variant of progress-bar

parent fbd6744f
No related branches found
No related tags found
3 merge requests!783V3.0.0,!741making onboarding-infos-covid-2 up to date,!720chore(ui): add storybook variant of progress-bar
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<p *ngIf="formType === formTypeEnum.profile">Création du profil</p> <p *ngIf="formType === formTypeEnum.profile">Création du profil</p>
<p *ngIf="formType === formTypeEnum.structure">Création de la structure</p> <p *ngIf="formType === formTypeEnum.structure">Création de la structure</p>
<p *ngIf="formType === formTypeEnum.personaloffer">Création d'offre d’accompagnements</p> <p *ngIf="formType === formTypeEnum.personaloffer">Création d'offre d’accompagnements</p>
<div fxLayout="row" fxLayoutAlign="space-between center" fxLayoutGap="20px"> <div class="container">
<label for="progressForm" [ngClass]="{ validate: currentPage === nbSteps }" <label for="progressForm" [ngClass]="{ validate: currentPage === nbSteps }"
>{{ progressStatus > 100 ? 100 : (progressStatus | number: '1.0-0') }}% >{{ progressStatus > 100 ? 100 : (progressStatus | number: '1.0-0') }}%
</label> </label>
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
@import 'breakpoint'; @import 'breakpoint';
.progressBar { .progressBar {
background-color: $grey-9;
padding: 1rem 6rem; padding: 1rem 6rem;
@media #{$tablet} { @media #{$tablet} {
...@@ -19,6 +18,14 @@ ...@@ -19,6 +18,14 @@
@media print { @media print {
display: none; display: none;
} }
.container {
display: flex;
flex-direction: row;
gap: 1.5rem;
align-items: center;
}
progress { progress {
width: 100%; width: 100%;
height: 6px; height: 6px;
...@@ -34,18 +41,18 @@ ...@@ -34,18 +41,18 @@
border-radius: 7px; border-radius: 7px;
} }
&::-webkit-progress-value { &::-webkit-progress-value {
background-color: $primary-color; background-color: $red;
border-radius: 12px; border-radius: 12px;
transition: width 0.5s; transition: width 0.5s;
} }
&::-moz-progress-bar { &::-moz-progress-bar {
background-color: $primary-color; background-color: $red;
border-radius: 12px; border-radius: 12px;
} }
} }
label { label {
@include font-bold-14; @include font-bold-14;
color: $primary-color; color: $red;
min-width: 26px; min-width: 26px;
} }
} }
......
...@@ -10,13 +10,15 @@ import { structureFormStep } from '../../structure-form/structureFormStep.enum'; ...@@ -10,13 +10,15 @@ import { structureFormStep } from '../../structure-form/structureFormStep.enum';
}) })
export class ProgressBarComponent implements OnChanges { export class ProgressBarComponent implements OnChanges {
@Input() formType: formType; @Input() formType: formType;
@Input() isEditMode: boolean; /** Number of current step */
@Input() currentPage: number; @Input({ required: true }) currentPage: number;
@Input() nbSteps: number; /** Total number of steps */
@Input({ required: true }) nbSteps: number;
public progressStatus: number; public progressStatus: number;
public formTypeEnum = formType; public formTypeEnum = formType;
public profileFormSteps: number = Object.keys(profileFormStep).length / 2; // When working with numeric enums, divide the result by 2, because a reverse mapping is generated.
public structureFormSteps: number = Object.keys(structureFormStep).length / 2; public profileFormSteps = Object.keys(profileFormStep).length / 2;
public structureFormSteps = Object.keys(structureFormStep).length / 2;
ngOnChanges(changes: SimpleChanges): void { ngOnChanges(changes: SimpleChanges): void {
if (changes.currentPage) { if (changes.currentPage) {
......
import { CommonModule } from '@angular/common';
import type { Meta, StoryObj } from '@storybook/angular';
import { moduleMetadata } from '@storybook/angular';
import { formType } from '../../formType.enum';
import { ProgressBarComponent } from './progress-bar.component';
// More on how to set up stories at: https://storybook.js.org/docs/angular/writing-stories/introduction
const meta: Meta<ProgressBarComponent> = {
title: 'Form/Progress bar',
component: ProgressBarComponent,
tags: ['autodocs'],
decorators: [
moduleMetadata({
declarations: [],
imports: [CommonModule],
}),
],
argTypes: {},
};
export default meta;
type Story = StoryObj<ProgressBarComponent>;
export const ProgressBar: Story = {
args: {
currentPage: 5,
formType: formType.account,
nbSteps: 15,
},
argTypes: {
currentPage: {
type: 'number',
description: 'Play with this value to see the animation of the progress',
control: {
type: 'range',
min: 0,
max: 15,
},
},
},
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment