diff --git a/src/app/form/form-view/global-components/progress-bar/progress-bar.component.html b/src/app/form/form-view/global-components/progress-bar/progress-bar.component.html index e3557df5af8c7c5b205d2342ba549434230ffa09..150f1370898a393952194579058764966a669c5f 100644 --- a/src/app/form/form-view/global-components/progress-bar/progress-bar.component.html +++ b/src/app/form/form-view/global-components/progress-bar/progress-bar.component.html @@ -3,7 +3,7 @@ <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.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 }" >{{ progressStatus > 100 ? 100 : (progressStatus | number: '1.0-0') }}% </label> diff --git a/src/app/form/form-view/global-components/progress-bar/progress-bar.component.scss b/src/app/form/form-view/global-components/progress-bar/progress-bar.component.scss index 3d2c2b9dce371cd804ae08ced91ce1e8e4f6c771..72b5f2c747f83791268e0c4f9c54d249c4538cdb 100644 --- a/src/app/form/form-view/global-components/progress-bar/progress-bar.component.scss +++ b/src/app/form/form-view/global-components/progress-bar/progress-bar.component.scss @@ -4,7 +4,6 @@ @import 'breakpoint'; .progressBar { - background-color: $grey-9; padding: 1rem 6rem; @media #{$tablet} { @@ -19,6 +18,14 @@ @media print { display: none; } + + .container { + display: flex; + flex-direction: row; + gap: 1.5rem; + align-items: center; + } + progress { width: 100%; height: 6px; @@ -34,18 +41,18 @@ border-radius: 7px; } &::-webkit-progress-value { - background-color: $primary-color; + background-color: $red; border-radius: 12px; transition: width 0.5s; } &::-moz-progress-bar { - background-color: $primary-color; + background-color: $red; border-radius: 12px; } } label { @include font-bold-14; - color: $primary-color; + color: $red; min-width: 26px; } } diff --git a/src/app/form/form-view/global-components/progress-bar/progress-bar.component.ts b/src/app/form/form-view/global-components/progress-bar/progress-bar.component.ts index 7b2862691b2812a75c1e3e4f35670895bd9affc6..088e78892c779a9dcc762b03c2d6d44953741f63 100644 --- a/src/app/form/form-view/global-components/progress-bar/progress-bar.component.ts +++ b/src/app/form/form-view/global-components/progress-bar/progress-bar.component.ts @@ -10,13 +10,15 @@ import { structureFormStep } from '../../structure-form/structureFormStep.enum'; }) export class ProgressBarComponent implements OnChanges { @Input() formType: formType; - @Input() isEditMode: boolean; - @Input() currentPage: number; - @Input() nbSteps: number; + /** Number of current step */ + @Input({ required: true }) currentPage: number; + /** Total number of steps */ + @Input({ required: true }) nbSteps: number; public progressStatus: number; public formTypeEnum = formType; - public profileFormSteps: number = Object.keys(profileFormStep).length / 2; - public structureFormSteps: number = Object.keys(structureFormStep).length / 2; + // When working with numeric enums, divide the result by 2, because a reverse mapping is generated. + public profileFormSteps = Object.keys(profileFormStep).length / 2; + public structureFormSteps = Object.keys(structureFormStep).length / 2; ngOnChanges(changes: SimpleChanges): void { if (changes.currentPage) { diff --git a/src/app/form/form-view/global-components/progress-bar/progress-bar.stories.ts b/src/app/form/form-view/global-components/progress-bar/progress-bar.stories.ts new file mode 100644 index 0000000000000000000000000000000000000000..25d0b7786a5447784c8aca962427a063f047b645 --- /dev/null +++ b/src/app/form/form-view/global-components/progress-bar/progress-bar.stories.ts @@ -0,0 +1,41 @@ +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, + }, + }, + }, +};