-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(submit-button): added loading state
- Loading branch information
Nikolay Poluhin
committed
Nov 3, 2023
1 parent
729472d
commit 9f38f05
Showing
4 changed files
with
66 additions
and
6 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
src/features/headless-checkout/web-components/submit-button/submit-button-attributes.enum.ts
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,4 @@ | ||
export enum SubmitButtonAttributes { | ||
text = 'text', | ||
isLoading = 'isLoading', | ||
} |
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
16 changes: 16 additions & 0 deletions
16
src/features/headless-checkout/web-components/submit-button/submit-button.template.ts
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,16 @@ | ||
const getLoaderTemplate = (): string => { | ||
return ` | ||
<div class="loader"></div> | ||
`; | ||
}; | ||
|
||
export const getSubmitButtonTemplate = ( | ||
text: string, | ||
isLoading: boolean, | ||
): string => { | ||
return ` | ||
<button> | ||
${isLoading ? getLoaderTemplate() : text} | ||
</button> | ||
`; | ||
}; |