-
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.
Feat(web-twig): Make Toast work with dynamic collapsible queue and dy…
…namic ToastBars #DS-1223
- Loading branch information
Showing
12 changed files
with
381 additions
and
115 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Toast } from '@lmc-eu/spirit-web/src/js/index.esm'; | ||
|
||
const addDynamicToast = (event, containerId) => { | ||
const formElement = event.target.closest('form'); | ||
const config = { | ||
color: formElement.querySelector('#toast-color').value, | ||
containerId, | ||
content: formElement.querySelector('#toast-content').value, | ||
hasIcon: formElement.querySelector('#toast-has-icon').checked, | ||
id: `my-dynamic-toast-${Date.now()}`, | ||
isDismissible: formElement.querySelector('#toast-is-dismissible').checked, | ||
}; | ||
|
||
const toast = new Toast(null, config); | ||
toast.show(); | ||
console.log('Created dynamic toast with config:', config); | ||
}; | ||
|
||
// Make it available in the global scope | ||
window.addDynamicToast = addDynamicToast; | ||
|
||
export default addDynamicToast; |
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
Oops, something went wrong.