Skip to content

Commit

Permalink
Update toaster to allow for innerHTML in descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
louisescher committed Dec 1, 2024
1 parent d148c72 commit ae6ea11
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/studiocms_ui/src/components/Toast/Toaster.astro
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const {

if (props.closeButton || props.persistent) {
const closeIconContainer = document.createElement('button');
closeIconContainer.classList.add('close-icon-container')
closeIconContainer.classList.add('close-icon-container');
closeIconContainer.addEventListener('click', () => removeToast(toastID));
closeIconContainer.innerHTML = getIconString('x-mark', 'close-icon', 24, 24);

Expand All @@ -114,7 +114,7 @@ const {

if (props.description) {
const toastDesc = document.createElement('span');
toastDesc.textContent = props.description;
toastDesc.innerHTML = props.description;
toastDesc.classList.add('toast-desc');

toastContainer.appendChild(toastDesc);
Expand Down
3 changes: 3 additions & 0 deletions packages/studiocms_ui/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
export type ToastProps = {
title: string;
/**
* This will get passed to the component as unsanitized HTML. DO NOT PUT USER-GENERATED CONTENT HERE!
*/
description?: string;
type: 'success' | 'warning' | 'danger' | 'info';
duration?: number;
Expand Down

0 comments on commit ae6ea11

Please sign in to comment.