File tree Expand file tree Collapse file tree
src/components/Consent/Preferences/client Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -261,16 +261,21 @@ export class ConsentPreferencesElement extends LitElement {
261261 // Example: Clear marketing cookies
262262 }
263263
264- private showNotification ( message : string ) : void {
264+ private showNotification ( message : string , type : 'success' | 'error' = 'success' ) : void {
265265 document
266266 . querySelectorAll < HTMLDivElement > ( '[data-testid="consent-toast"]' )
267267 . forEach ( ( existingToast ) => existingToast . remove ( ) )
268268
269+ const typeClasses : Record < 'success' | 'error' , string > = {
270+ success : 'bg-green-600' ,
271+ error : 'bg-red-600'
272+ }
273+
269274 // Create a simple notification
270275 const notification = document . createElement ( 'div' )
271- notification . className =
272- 'fixed top-4 right-4 bg-green-600 text-white px-6 py-3 rounded-lg shadow-lg z-50 transition-all duration-300'
276+ notification . className = `fixed top-4 right-4 ${ typeClasses [ type ] } text-white px-6 py-3 rounded-lg shadow-lg z-50 transition-all duration-300`
273277 notification . dataset [ 'testid' ] = 'consent-toast'
278+ notification . dataset [ 'toastType' ] = type
274279 notification . textContent = message
275280
276281 document . body . appendChild ( notification )
You can’t perform that action at this time.
0 commit comments