Files
overleaf-cep/services/web/app/views/_mixins/notification.pug
T
Antoine Clausse b57df2602a [web] Reapply: Make CIAM login notification dismissible (with cookies) (#30829)
* Reapply "[web] Make CIAM login notification dismissible (with cookies) (#30251)"

This reverts commit 7bafafe54b24245c4da88d1c81540a3b1c98231b.

* Add a test `should redirect to /register with a notification`

* Fix destructuring of options in notification mixins

* Remove `data-ol-dismiss-cookie-paths` default, enforce it being set

* Handle the case of standard notifications without the dismiss setup

Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>

---------

Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
GitOrigin-RevId: fbf441c1efe0aa5d80899a31ec3ad51c1dba6d24
2026-01-23 09:06:10 +00:00

47 lines
1.4 KiB
Plaintext

//- to be kept in sync with frontend/js/shared/components/notification.tsx
include ./material_symbol
mixin notificationIcon(type)
if type === 'info'
+material-symbol('info')
else if type === 'success'
+material-symbol('check_circle')
else if type === 'error'
+material-symbol('error')
else if type === 'warning'
+material-symbol('warning')
mixin notification(options)
- var {ariaLive, id, type, title, content, disclaimer, className, dismissId, dismissCookiePaths} = options ?? {}
- var classNames = `notification notification-type-${type} ${className ? className : ''} ${isActionBelowContent ? 'notification-cta-below-content' : ''}`
if dismissId && dismissedNotifications.includes(dismissId)
//- Notification has been dismissed, do not render
else
div(
aria-live=ariaLive
role='alert'
id=id
class=classNames
data-ol-dismiss-id=dismissId
data-ol-dismiss-cookie-paths=dismissCookiePaths && dismissCookiePaths.join(',')
)
.notification-icon
+notificationIcon(type)
.notification-content-and-cta
.notification-content
if title
p
b #{title}
| !{content}
block
//- TODO: handle action
//- if action
//- .notification-cta
if disclaimer
.notification-disclaimer #{disclaimer}
if dismissId
.notification-close-btn
button(aria-label=translate('close') data-ol-dismiss-button)
+material-symbol('close')