-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from squidit/feature/SQ-61997-melhorias-tela-d…
…e-login feature/SQ-61997-melhorias-tela-de-login
- Loading branch information
Showing
8 changed files
with
372 additions
and
255 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<countdown | ||
[config]="{ | ||
leftTime: leftTime, | ||
format: format, | ||
notify: notify | ||
}" | ||
(event)="eventMap($event)" | ||
/> |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
::ng-deep { | ||
sq-countdown { | ||
min-width: min-content; | ||
countdown.count-down { | ||
span { | ||
color: var(--text_color); | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { Component, EventEmitter, Input, Output } from '@angular/core' | ||
import { CountdownComponent, CountdownEvent } from 'ngx-countdown' | ||
|
||
/** | ||
* Interface for the return event os emitters. | ||
* @interface | ||
*/ | ||
interface ReturnEvent { | ||
/** | ||
* The time left in the countdown. | ||
*/ | ||
left: number | ||
} | ||
|
||
/** | ||
* Represents the SqCountdownComponent, a component for countdown. | ||
* | ||
* @example | ||
* <sq-countdown [leftTime]="10"></sq-countdown> | ||
*/ | ||
@Component({ | ||
selector: 'sq-countdown', | ||
templateUrl: './sq-countdown.component.html', | ||
styleUrls: ['./sq-countdown.component.scss'], | ||
standalone: true, | ||
imports: [CountdownComponent], | ||
}) | ||
export class SqCountdownComponent { | ||
/** | ||
* Starting time to countdown (e.g., 5.5, 30) (Unit: seconds). | ||
*/ | ||
@Input() leftTime = 10 | ||
|
||
/** | ||
* Formats a date value, pls refer to [Accepted patterns](https://angular.io/api/common/DatePipe#usage-notes). | ||
*/ | ||
@Input() format?: string = 'mm:ss' | ||
|
||
/** | ||
* Should be trigger type `notify` event on the x second. When values is `0` will be trigger every time. | ||
*/ | ||
@Input() notify?: number[] | number | ||
|
||
/** | ||
* Event emitter for when the countdown starts. | ||
*/ | ||
@Output() startEmitter: EventEmitter<ReturnEvent> = new EventEmitter() | ||
|
||
/** | ||
* Event emitter for when the count reaches the input notify times. | ||
*/ | ||
@Output() notifyEmitter: EventEmitter<ReturnEvent> = new EventEmitter() | ||
|
||
/** | ||
* Event emitter for when the countdown ends. | ||
*/ | ||
@Output() doneEmitter: EventEmitter<ReturnEvent> = new EventEmitter() | ||
|
||
/** | ||
* Map the CountdownEvents to emit startEmitter, notifyEmitter or doneEmitter. | ||
* @param event - The event associated with the CountdownEvents. | ||
*/ | ||
eventMap(event: CountdownEvent) { | ||
const action = event.action as "start" | "notify" | "done" | ||
if (action && this[`${action}Emitter`]) { | ||
const returnEvent: ReturnEvent = { | ||
left: event.left | ||
} | ||
this[`${action}Emitter`].emit(returnEvent) | ||
} | ||
} | ||
} |
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