This repository has been archived by the owner on Jan 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 486
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add button group to alerts [#2303] Signed-off-by: Vikram Yadav <[email protected]>
- Loading branch information
Vikram Yadav
committed
May 14, 2021
1 parent
bd0c4c8
commit 97d521b
Showing
24 changed files
with
208 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,44 @@ | ||
package component | ||
|
||
type AlertStatus string | ||
|
||
const ( | ||
// AlertStatusError is an error alert. | ||
AlertStatusError AlertStatus = "error" | ||
// AlertStatusWarning is a warning alert. | ||
AlertStatusWarning AlertStatus = "warning" | ||
// AlertStatusInfo is an info alert. | ||
AlertStatusInfo AlertStatus = "info" | ||
// AlertStatusSuccess is a success alert. | ||
AlertStatusSuccess AlertStatus = "success" | ||
// AlertStatusNeutral is a neutral alert. | ||
AlertStatusNeutral AlertStatus = "neutral" | ||
) | ||
|
||
type AlertType string | ||
|
||
const ( | ||
// AlertTypeError is an error alert. | ||
AlertTypeError AlertType = "error" | ||
// AlertTypeWarning is a warning alert. | ||
AlertTypeWarning AlertType = "warning" | ||
// AlertTypeInfo is an info alert. | ||
AlertTypeInfo AlertType = "info" | ||
// AlertTypeSuccess is a success alert. | ||
AlertTypeSuccess AlertType = "success" | ||
AlertTypeBanner AlertType = "banner" | ||
AlertTypeDefault AlertType = "default" | ||
AlertTypeLight AlertType = "light" | ||
) | ||
|
||
// Alert is an alert. It can be used in components which support alerts. | ||
type Alert struct { | ||
Type AlertType `json:"type"` | ||
Message string `json:"message"` | ||
Status AlertStatus `json:"status"` | ||
Type AlertType `json:"type"` | ||
Message string `json:"message"` | ||
Closable bool `json:"closable"` | ||
ButtonGroup *ButtonGroup `json:"buttonGroup"` | ||
} | ||
|
||
// NewAlert creates an instance of Alert. | ||
func NewAlert(alertType AlertType, message string) Alert { | ||
func NewAlert(alertStatus AlertStatus, alertType AlertType, message string, closable bool, buttonGroup *ButtonGroup) Alert { | ||
return Alert{ | ||
Type: alertType, | ||
Message: message, | ||
Status: alertStatus, | ||
Type: alertType, | ||
Message: message, | ||
ButtonGroup: buttonGroup, | ||
Closable: closable, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 7 additions & 10 deletions
17
web/src/app/modules/shared/components/presentation/alert/alert.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
<div [ngClass]="['alert', alertClass]" role="alert"> | ||
<div class="alert-items"> | ||
<div class="alert-item static"> | ||
<div class="alert-icon-wrapper"> | ||
<clr-icon [attr.shape]="shape" class="alert-icon"></clr-icon> | ||
</div> | ||
<span class="alert-text">{{ message }}</span> | ||
</div> | ||
</div> | ||
</div> | ||
<cds-alert-group type="{{type}}" status="{{status}}" *ngIf="showAlert"> | ||
<cds-alert [closable]="closable" (closeChange)="close()"> | ||
{{message}} | ||
</cds-alert> | ||
<app-button-group [view]="buttonGroup" *ngIf="buttonGroup"> | ||
</app-button-group> | ||
</cds-alert-group> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.