Skip to content

Commit

Permalink
feat: make times default close type
Browse files Browse the repository at this point in the history
  • Loading branch information
theoomoregbee committed Oct 16, 2018
1 parent 451ce9d commit 67b81ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ imports: [

## Usage
```
<ng-alert [(message)]="message" [dismissable]="true" [closeType]="closeTypes.TIMES"></ng-alert>
<ng-alert [(message)]="message" [dismissable]="true"></ng-alert>
```
* **message**: is a two bounded attribute which takes in `IMessage`
```typescript
Expand All @@ -60,13 +60,19 @@ imports: [
```
`type` can be `MessageType.info`, `MessageType.success`, `MessageType.error` or `MessageType.warning`
* **dismissable**: is an optional field to allow users to close the alert or not. `boolean`. Defaults to
* **closeType**: is used to determine which type of close button should be place on it, and only accepts `CloseType` enum. Defaults to `CloseType.NORMAL`
* **closeType**: is used to determine which type of close button should be place on it, and only accepts `CloseType` enum. Defaults to `CloseType.TIMES`
```typescript
export enum CloseType {
TIMES, NORMAL
}

// usage
// NORMAL -> the close button is beneath the alert message
// TIMES -> the close button is by the far right with x
<ng-alert [(message)]="message" [dismissable]="true" [closeType]="closeTypes.NORMAL"></ng-alert>
```


## App Level Alert
You can decide to make use of the `NgAlertService` to push new messages, useful if you want to maintain a central point of alerting your users of anything, like at the top of your page.
```typescript
Expand Down
2 changes: 1 addition & 1 deletion projects/alert/src/lib/alert.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class NgAlertComponent {
@Input() dismissable: boolean;
rawMessage: IMessage;
@Output() messageChange = new EventEmitter();
@Input() closeType: CloseType = CloseType.NORMAL;
@Input() closeType: CloseType = CloseType.TIMES;
closeTypes = CloseType;

@Input()
Expand Down

0 comments on commit 67b81ef

Please sign in to comment.