Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(alert): added alert component #7

Merged
merged 7 commits into from
Aug 22, 2024
Merged

feat(alert): added alert component #7

merged 7 commits into from
Aug 22, 2024

Conversation

LAMM26
Copy link
Collaborator

@LAMM26 LAMM26 commented Aug 21, 2024

Nouveau composant pour les alertes. Ajout dans la démo.

@LAMM26 LAMM26 self-assigned this Aug 21, 2024
@LAMM26 LAMM26 added the enhancement New feature or request label Aug 21, 2024
Comment on lines 27 to 37
getAlertClass() {
return `container --${AlertType[this.type()]}`;
}

getIconClass() {
return `icon --${AlertType[this.type()]}`;
}

getIcon(): string | undefined {
return AlertIcon[this.type()];
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On pourrait utiliser le computed pour optimiser

Suggested change
getAlertClass() {
return `container --${AlertType[this.type()]}`;
}
getIconClass() {
return `icon --${AlertType[this.type()]}`;
}
getIcon(): string | undefined {
return AlertIcon[this.type()];
}
typeName = computed(() => AlertType[this.type()]);
iconName = computed(() => AlertIcon[this.type()]);

{{ message() }}
</div>
@if (closeable()) {
<mat-icon class="close" (click)="showAlert = !showAlert">close</mat-icon>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Habituellement, les actions pour un usager devrait être déclancher via un bouton. Cela nous permet de normaliser l'accessibilité du site. <button mat-icon-button>?

styleUrls: ['./alert.component.scss']
})
export class AlertComponent {
constructor() {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

À supprimer

closeable = input<boolean>(false);
isHandset = input<boolean>();

showAlert = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pour le controle de la visibilité de cette composante, la problématique que je vois c'est qu'une fois fermé on ne peut pas l'ouvrir de nouveau?
C'est le concept de "controlled" vs "uncontrolled" components, ici vu que la composante peut disparaitre, j'ai l'impression qu'elle devrait être une composante controllé. C'est à dire, laisser la composante parente controllé la visibilité. Soit avoir un input isOpen ou laisser le parent gérer via un NgIf dans le template. Le bouton onClose émetterait un événement lorsqu'il est cliqué. Sinon, on pourrait avoir un Signal.Model qui permet le two-way communication.

@alecarn alecarn merged commit 360d8f3 into next Aug 22, 2024
3 checks passed
@alecarn alecarn deleted the alert branch August 22, 2024 18:34
alecarn pushed a commit that referenced this pull request Aug 22, 2024
# [1.0.0-next.15](v1.0.0-next.14...v1.0.0-next.15) (2024-08-22)

### Features

* **alert:** added alert component ([#7](#7)) ([360d8f3](360d8f3))
@alecarn
Copy link
Contributor

alecarn commented Aug 22, 2024

🎉 This PR is included in version 1.0.0-next.15 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released on @next
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants