Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

Commit 746e6eb

Browse files
committed
✨ Creation des composants pour les alerts
1 parent 71c657c commit 746e6eb

File tree

7 files changed

+35
-6
lines changed

7 files changed

+35
-6
lines changed

src/app/shared/components/error/error.component.html renamed to src/app/shared/components/alert/error/error.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="p-4 rounded-md bg-red-50" [ngClass]="class">
22
<div class="flex">
3-
<div class="flex-shrink-0">
3+
<div class="shrink-0">
44
<svg class="w-5 h-5 text-red-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
55
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM8.28 7.22a.75.75 0 0 0-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 1 0 1.06 1.06L10 11.06l1.72 1.72a.75.75 0 1 0 1.06-1.06L11.06 10l1.72-1.72a.75.75 0 0 0-1.06-1.06L10 8.94 8.28 7.22Z" />
66
</svg>

src/app/shared/components/error/error.component.ts renamed to src/app/shared/components/alert/error/error.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import { Component, Input, OnInit } from '@angular/core';
22

33
@Component({
44
selector: 'cosna-errors',
5-
templateUrl: './error.component.html',
6-
styleUrls: ['./error.component.scss']
5+
templateUrl: './error.component.html'
76
})
87
export class ErrorComponent implements OnInit {
98
@Input() class!: string;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<div class="p-4 rounded-md bg-green-50" [ngClass]="class">
2+
<div class="flex">
3+
<div class="shrink-0">
4+
<svg class="w-5 h-5 text-green-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
5+
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm3.857-9.809a.75.75 0 0 0-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z" />
6+
</svg>
7+
</div>
8+
<div class="ml-3">
9+
<p class="text-sm font-medium text-green-800">{{ message }}</p>
10+
</div>
11+
</div>
12+
</div>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Component, Input, OnInit } from '@angular/core';
2+
3+
@Component({
4+
selector: 'cosna-success',
5+
templateUrl: './success.component.html'
6+
})
7+
export class SuccessComponent implements OnInit {
8+
@Input() class!: string;
9+
@Input() message!: string;
10+
11+
constructor() { }
12+
13+
ngOnInit(): void {
14+
}
15+
16+
}

src/app/shared/components/buttons/primary/primary.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
[type]="type"
33
[disabled]="(loading$ | async)"
44
[ngClass]="class"
5-
class="inline-flex items-center font-mono px-4 py-2 text-sm font-medium uppercase tracking-[1.25px] text-white bg-primary-600 border border-transparent rounded-md shadow-md hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 disabled:opacity-25 transition ease-in-out duration-150"
5+
class="relative inline-flex items-center font-mono px-4 py-2 text-sm font-medium uppercase tracking-[1.25px] text-white bg-primary-600 border border-transparent rounded-md shadow-md hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 disabled:opacity-50 disabled:cursor-not-allowed transition ease-in-out duration-150"
66
>
7-
<span *ngIf="(loading$ | async)" class="absolute inset-y-0 left-0 flex items-center pl-3">
7+
<span *ngIf="(loading$ | async)" class="absolute inset-y-0 left-0 flex items-center pl-3 mr-2.5">
88
<svg class="w-5 h-5 mr-3 -ml-1 text-white animate-spin" fill="none" viewBox="0 0 24 24">
99
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"/>
1010
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"/>

src/app/shared/components/error/error.component.scss

Whitespace-only changes.

src/app/shared/shared.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@ import { ThemeModule } from './themes/theme.module';
66

77
import { OverlapingLabelComponent } from './components/inputs/overlaping-label/overlaping-label.component';
88
import { PrimaryComponent as ButtonPrimary } from './components/buttons/primary/primary.component';
9-
import { ErrorComponent } from './components/error/error.component';
9+
import { ErrorComponent } from './components/alert/error/error.component';
10+
import { SuccessComponent } from './components/alert/success/success.component';
1011

1112

1213
const MODULES = [CommonModule, ThemeModule];
1314
const DECLARATIONS = [
1415
ButtonPrimary,
1516
OverlapingLabelComponent,
1617
ErrorComponent,
18+
SuccessComponent,
1719
];
1820

1921
@NgModule({

0 commit comments

Comments
 (0)